In the latest version of Iesi.Collections is missing Iesi.Collections.Generic.ISet. There seem to be three alternatives:

  1. LinkedHashSet
  2. ReadOnlySet
  3. SynchronizedSet

Iesi.Collections.Generic.ReadOnlySet seems to be the closest to the ISet, and the documentation states:

... although it's advertised as immutable it really isn't. 
Anyone with access to the wrapped set can still change the set. 

It seems that the ReadOnlySet is the best replacement for the ISet? Currently the implementation is adding items to a set via public methods so it seems like the best fit. The alternatives (IList, bag?) seem to require more resources or are not as quick/efficient)? Is there a better alternative? (The list shouldn't have duplicates, which could be verified manually)

I'll do stuff like:

public virtual ISet<MyClass> MyClass
{
    get { return this.myClass }
}

public virtual void AddItem(MyClass item)
{
    ... // Null checks and initialize ISet if null
    myClass.Add(item)
}

Basically it boils down to the alternatives, are there alternatives without negative consequences such as in speed etc.?

有帮助吗?

解决方案

Well, getting Iesi.Collections from Nuget only offers v. 4.

The solution here worked with NHibernate 3.x, but this question will probably be relevant with NHibernate 4+. Issuewith NHibernate, Fluent NHibernate and Iesi.Collection. What would you try next?

I deleted the Iesi reference and added NHibernate which included an old version of Iesi with ISet. It doesn't actually solve the ISet vs. alternative, but it does resolve my issue so I can just continue using ISet.

Perhaps they will add it be NHibernate 4.0 release, or else it will need to be converted at that time.

其他提示

Iesi.Collections v4 is for .Net 4. The correct replacement for Iesi 3's ISet is to use the ISet that was included in .Net's System.Collections.Generic in .Net4.0.

You would typically also use .Net's HashSet class.

The classes remaining in Iesi in v4 is some special case implementations, rarely used.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top