NHibernate semantics:
-
List: Ordered collection of entities, duplicate allowed. Use a .NET
IList
in code. The index column will need to be mapped in NHibernate. -
Set: Unordered collection of unique entities, duplicates not allowed. Use
Iesi.Collection.ISet
in code (NH prior to v4) orSystem.Collections.Generic.ISet
(NH v4+). It is important to overrideGetHashCode
andEquals
to indicate the business definition of duplicate. Can be sorted by defining an orderby or by defining a comparer resulting in aSortedSet
result. -
Bag: Unordered list of entities, duplicates allowed. Use a .NET
ICollection<T>
in code. The index column of the list is not mapped and not honored by NHibernate.