Namespaces

Types

Type IPersistentCollection

Namespace NHibernate.Collection

Methods

Properties

Public instance methods

bool AfterInitialize(ICollectionPersister persister)

Called after initializing from cache
Parameters
return bool
ICollectionPersister persister

void AfterRowInsert(ICollectionPersister persister, object entry, int i)

Called after inserting a row, to fetch the natively generated id
Parameters
ICollectionPersister persister
object entry
int i

void BeforeInitialize(ICollectionPersister persister)

Called before any elements are read into the collection, allowing appropriate initializations to occur.
Parameters
ICollectionPersister persister The ICollectionPersister for this persistent collection.

void BeginRead()

Called just before reading any rows from the IDataReader

void ClearDirty()

Clear the dirty flag, after flushing changes to the database.

void Dirty()

Mark the collection as dirty

object Disassemble(ICollectionPersister persister)

Disassemble the collection, ready for the cache
Parameters
return object The contents of the persistent collection in a cacheable form.
ICollectionPersister persister The ICollectionPersister for this Collection.

bool EndRead(ICollectionPersister persister)

Called after reading all rows from the IDataReader
This should be overridden by sub collections that use temporary collections to store values read from the db.
Parameters
return bool
ICollectionPersister persister

IEnumerable Entries()

Iterate all collection entries, during update of the database
Parameters
return IEnumerable An IEnumerable that gives access to all entries in the collection.

bool EntryExists(object entry, int i)

Does an element exist at this entry in the collection?
Parameters
return bool
object entry
int i

bool EqualsSnapshot(IType elementType)

Does the current state exactly match the snapshot?
Parameters
return bool ${WriteSummary(content)}
IType elementType The IType to compare the elements of the Collection.

void ForceInitialization()

To be called internally by the session, forcing immediate initalization.
This method is similar to Initialize , except that different exceptions are thrown.

ICollection GetDeletes(IType elemType, bool indexIsFormula)

Get all the elements that need deleting
Parameters
return ICollection
IType elemType
bool indexIsFormula

object GetElement(object entry)

Get the value of the given collection entry
Parameters
return object
object entry

object GetIdentifier(object entry, int i)

Get the identifier of the given collection entry
Parameters
return object
object entry
int i

object GetIndex(object entry, int i)

Get the index of the given collection entry
Parameters
return object
object entry
int i

ICollection GetOrphans(object snapshot, Type entityName)

Get all "orphaned" elements
Parameters
return ICollection An ICollection that contains all of the elements that have been orphaned.
object snapshot The snapshot of the collection.
Type entityName The persistent class whose objects the collection is expected to contain.

ICollection GetSnapshot(ICollectionPersister persister)

Return a new snapshot of the current state of the collection
Parameters
return ICollection
ICollectionPersister persister

object GetSnapshotElement(object entry, int i)

Get the snapshot value of the given collection entry
Parameters
return object
object entry
int i

object GetValue()

Return the user-visible collection (or array) instance
Parameters
return object By default, the NHibernate wrapper is an acceptable collection for the end user code to work with because it is interface compatible. An NHibernate PersistentList is an IList, an NHibernate PersistentMap is an IDictionary and those are the types user code is expecting.

void InitializeFromCache(ICollectionPersister persister, object disassembled, object owner)

Read the state of the collection from a disassembled cached value.
Parameters
ICollectionPersister persister
object disassembled
object owner

bool IsSnapshotEmpty(ICollection snapshot)

Parameters
return bool
ICollection snapshot

bool IsWrapper(object collection)

Is this the wrapper for the given underlying collection instance?
Parameters
return bool ${WriteSummary(content)}
object collection The collection to see if this IPersistentCollection is wrapping.

bool NeedsInserting(object entry, int i, IType elemType)

Do we need to insert this element?
Parameters
return bool
object entry
int i
IType elemType

bool NeedsRecreate(ICollectionPersister persister)

Gets a Boolean indicating if the rows for this collection need to be recreated in the table.
Parameters
return bool ${WriteSummary(content)}
ICollectionPersister persister The ICollectionPersister for this Collection.

bool NeedsUpdating(object entry, int i, IType elemType)

Do we need to update this element?
Parameters
return bool
object entry
int i
IType elemType

void PostAction()

Clears out any Queued Additions.
After a Flush() the database is in synch with the in-memory contents of the Collection. Since everything is in synch remove any Queued Additions.

void PreInsert(ICollectionPersister persister)

Called before inserting rows, to ensure that any surrogate keys are fully generated
Parameters
ICollectionPersister persister

object ReadFrom(IDataReader reader, ICollectionPersister role, ICollectionAliases descriptor, object owner)

Reads the row from the IDataReader .
${WriteSummary(content)}
Parameters
return object The object that was contained in the row.
IDataReader reader The IDataReader that contains the value of the Identifier
ICollectionPersister role The persister for this Collection.
ICollectionAliases descriptor The descriptor providing result set column names
object owner The owner of this Collection.

bool SetCurrentSession(ISessionImplementor session)

Associate the collection with the given session.
Parameters
return bool false if the collection was already associated with the session
ISessionImplementor session

bool UnsetSession(ISessionImplementor session)

Disassociate this collection from the given session.
Parameters
return bool true if this was currently associated with the given session
ISessionImplementor session

Public properties

ICollectionSnapshot CollectionSnapshot get; set;

return ICollectionSnapshot

bool Empty get;

Is the initialized collection empty?
return bool

bool HasQueuedAdds get;

return bool

bool IsDirectlyAccessible get; set;

Gets a Boolean indicating if the underlying collection is directly accessable through code.
${WriteSummary(content)}
return bool

bool IsDirty get;

Is the collection dirty? Note that this is only reliable during the flush cycle, after the collection elements are dirty checked against the snapshot.
return bool

object Owner get; set;

The owning entity.
Note that the owner is only set during the flush cycle, and when a new collection wrapper is created while loading an entity.
return object

ICollection QueuedAddsCollection get;

return ICollection

bool WasInitialized get;

return bool