Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Iesi.Collections.Generic.LinkedHashSet<T> a best alternative of Iesi.Collections.Generic.ISet<T> while migrating to NHibernate 4.0.3.4000

Recently I have upgraded my NHibernate library with latest version 4.0.3.4000. After that - during compilation I faced an issue related to "Iesi.Collections.Generic.ISet". From details I understand that - this interface is dropped off and alternate options are available - one of it is LinkedHashSet.

I would like to know that - is this the best alternate to replace ISet?

like image 953
user17276 Avatar asked Sep 05 '25 22:09

user17276


1 Answers

This is from release notes:

** Known BREAKING CHANGES from NH3.3.3.GA to 4.0.0.GA

NHibernate now targets .Net 4.0. Many uses of set types from Iesi.Collections have now been changed to use corresponding types from the BCL. The API for these types are slightly different.

So we can now use interface

System.Collections.Generic.ISet<T>

and as its implementation even the System built in types, e.g.

System.Collections.Generic.HashSet<T>

And therefore reduce dependency on iesi library...

But as discussed here: What is a suitable NHibernate / Iesi.Collections.Generic.ISet<T> replacement? - we can also use the LinkedHashSet<T>, ReadOnlySet<T>, SychronizedSet<T>

Also check the Customer.cs in NHibernate test project:

using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace NHibernate.DomainModel.Northwind.Entities
{
    public class Customer
    {
        private readonly ISet<Order> _orders;

        public Customer()
        {
            _orders = new System.Collections.Generic.HashSet<Order>();
        }
        public virtual ISet<Order> Orders
        {
            get { return _orders; }
        }
        ...
like image 93
Radim Köhler Avatar answered Sep 11 '25 04:09

Radim Köhler