Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31197/src/NHibernate/Collection
Modified Files:
Bag.cs PersistentCollection.cs Set.cs
Log Message:
Added some comments about how the CollectionEntry is working and some
more comments to individual collection classes.
Index: Bag.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Bag.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Bag.cs 14 Oct 2004 04:33:13 -0000 1.9
--- Bag.cs 29 Nov 2004 04:45:50 -0000 1.10
***************
*** 157,160 ****
--- 157,171 ----
}
+ /// <summary>
+ /// Gets a <see cref="Boolean"/> indicating if this Bag needs to be recreated
+ /// in the database.
+ /// </summary>
+ /// <param name="persister"></param>
+ /// <returns>
+ /// <c>false</c> if this is a <c>one-to-many</c> Bag, <c>true</c> if this is not
+ /// a <c>one-to-many</c> Bag. Since a Bag is an unordered, unindexed collection
+ /// that permits duplicates it is not possible to determine what has changed in a
+ /// <c>many-to-many</c> so it is just recreated.
+ /// </returns>
public override bool NeedsRecreate(CollectionPersister persister)
{
Index: PersistentCollection.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/PersistentCollection.cs,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** PersistentCollection.cs 22 Sep 2004 04:46:43 -0000 1.16
--- PersistentCollection.cs 29 Nov 2004 04:45:50 -0000 1.17
***************
*** 267,270 ****
--- 267,284 ----
}
+ /// <summary>
+ /// Gets a <see cref="Boolean"/> indicating if the underlying collection is directly
+ /// accessable through code.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if we are not guaranteed that the NHibernate collection wrapper
+ /// is being used.
+ /// </value>
+ /// <remarks>
+ /// This is typically <c>false</c> whenever a transient object that contains a collection is being
+ /// associated with an ISession through <c>Save</c> or <c>SaveOrUpdate</c>. NHibernate can't guarantee
+ /// that it will know about all operations that would call cause NHibernate's collections to call
+ /// <c>Read()</c> or <c>Write()</c>.
+ /// </remarks>
public virtual bool IsDirectlyAccessible
{
***************
*** 296,299 ****
--- 310,323 ----
public abstract object Disassemble(CollectionPersister persister);
+ /// <summary>
+ /// Gets a <see cref="Boolean"/> indicating if the rows for this collection
+ /// need to be recreated in the table.
+ /// </summary>
+ /// <param name="persister">The <see cref="CollectionPersister"/> for this Collection.</param>
+ /// <returns>
+ /// <c>false</c> by default since most collections can determine which rows need to be
+ /// individually updated/inserted/deleted. Currently only <see cref="Bag"/>'s for <c>many-to-many</c>
+ /// need to be recreated.
+ /// </returns>
public virtual bool NeedsRecreate(CollectionPersister persister)
{
***************
*** 347,351 ****
--- 371,386 ----
// looks like it is used by IdentifierBag
+ /// <summary>
+ /// By default, no operation is performed. This provides a hook to get an identifer of the
+ /// collection row for <see cref="IdentifierBag"/>.
+ /// </summary>
+ /// <param name="persister">The <see cref="CollectionPersister"/> for this Collection.</param>
+ /// <param name="entry">
+ /// The entry to preInsert. If this is a Map this will be a DictionaryEntry. If this is
+ /// a List then it will be the object at that index.
+ /// </param>
+ /// <param name="i">The index of the Entry while enumerating through the Collection.</param>
public virtual void PreInsert(CollectionPersister persister, object entry, int i) {}
+
public abstract ICollection GetOrphans(object snapshot);
public static void IdentityRemoveAll(IList list, ICollection collection, ISessionImplementor session)
Index: Set.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Set.cs,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** Set.cs 21 Nov 2004 22:56:27 -0000 1.19
--- Set.cs 29 Nov 2004 04:45:50 -0000 1.20
***************
*** 424,428 ****
public override bool EntryExists(object entry, int i)
{
- //TODO: find out where this is used...
return true;
}
--- 424,427 ----
|