Classes

  ClassDescription
AbstractPersistentCollection
Base class for implementing IPersistentCollection.
PersistentArrayHolder
A persistent wrapper for an array. lazy initialization is NOT supported
PersistentBag
An unordered, unkeyed collection that can contain the same element multiple times. The .NET collections API has no Bag class. Most developers seem to use ILists to represent bag semantics, so NHibernate follows this practice.
PersistentIdentifierBag
Implements "bag" semantics more efficiently than a regular PersistentBag by adding a synthetic identifier column to the table.
PersistentList
A persistent wrapper for an IList
PersistentMap
A persistent wrapper for a IDictionary. Underlying collection is a Hashtable.
PersistentSet
.NET has no design equivalent for Java's Set so we are going to use the Iesi.Collections library. This class is internal to NHibernate and shouldn't be used by user code.

Interfaces

  InterfaceDescription
IPersistentCollection

Persistent collections are treated as value objects by NHibernate. ie. they have no independent existence beyond the object holding a reference to them. Unlike instances of entity classes, they are automatically deleted when unreferenced and automatically become persistent when held by a persistent object. Collections can be passed between different objects (change "roles") and this might cause their elements to move from one database table to another.

NHibernate "wraps" a collection in an instance of IPersistentCollection. This mechanism is designed to support tracking of changes to the collection's persistent state and lazy instantiation of collection elements. The downside is that only certain abstract collection types are supported and any extra semantics are lost.

Applications should never use classes in this namespace directly, unless extending the "framework" here.

Changes to structure of the collection are recorded by the collection calling back to the session. Changes to mutable elements (ie. composite elements) are discovered by cloning their state when the collection is initialized and comparing at flush time.