Namespaces

Types

Type AbstractPersistentCollection

Namespace NHibernate.Collection

Interfaces IPersistentCollection

Methods

Properties

Public instance methods

bool AfterInitialize(ICollectionPersister persister)

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

void BeginRead()

Called just before reading any rows from the IDataReader

void ClearDirty()

void DelayedAddAll(ICollection coll, ICollectionPersister persister)

After reading all existing elements from the database, add the queued elements to the underlying collection.
The default implementation is to throw an AssertionFailure because most collections do not support delayed addition. If the collection does then override this method.
Parameters
ICollection coll The ICollection to add.
ICollectionPersister persister The ICollectionPersister that is currently loading the collection.

void Dirty()

object Disassemble(ICollectionPersister persister)

Disassemble the collection, ready for the cache
Parameters
return object
ICollectionPersister persister

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

bool EntryExists(object entry, int i)

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

bool Equals(object obj)

Parameters
return bool
object obj

bool EqualsSnapshot(IType elementType)

Does the current state exactly match the snapshot?
Parameters
return bool
IType elementType

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)

Parameters
return object
object entry

int GetHashCode()

Parameters
return int

object GetIdentifier(object entry, int i)

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
object snapshot
Type entityName

ICollection GetSnapshot(ICollectionPersister persister)

Parameters
return ICollection
ICollectionPersister persister

object GetSnapshotElement(object entry, int i)

Parameters
return object
object entry
int i

Type GetType()

Parameters
return Type

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
object collection

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

void Read()

Called by any read-only method of the collection interface

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

Reads the row from the IDataReader .
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

string ToString()

Parameters
return string

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 static methods

void IdentityRemove(IList list, object obj, Type entityName, ISessionImplementor session)

Parameters
IList list
object obj
Type entityName
ISessionImplementor session

void IdentityRemoveAll(IList list, ICollection collection, Type entityName, ISessionImplementor session)

Parameters
IList list
ICollection collection
Type entityName
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;

return bool

object Owner get; set;

return object

ICollection QueuedAddsCollection get;

return ICollection

bool WasInitialized get;

return bool