Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22817/NHibernate/Impl
Modified Files:
SessionImpl.cs
Log Message:
Removed hacks that were added because of multiple open IDataReaders
throwing exceptions with MsSql.
Index: SessionImpl.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** SessionImpl.cs 3 May 2004 04:54:28 -0000 1.24
--- SessionImpl.cs 6 May 2004 13:14:02 -0000 1.25
***************
*** 3052,3152 ****
}
- #region - Session Helpers for handling PersistentCollections inside of a Component
-
- // key = ComponentCollectionKey(id, role)
- // value = PersistentCollection
- // contains the PersistentCollections that need to be resolved by a Component through
- // the use of ResolveIdentifier.
- private IDictionary unresolvedComponentCollections = new Hashtable();
-
- /// <summary>
- /// Key for the IDictionary that is storing the PersistentCollections that need to be
- /// Resolved for a Component
- /// </summary>
- private class ComponentCollectionKey
- {
- private object id;
- private string role;
-
- public ComponentCollectionKey(object id, string role)
- {
- this.id = id;
- this.role = role;
- }
-
- public override int GetHashCode()
- {
- unchecked
- {
- return id.GetHashCode() + role.GetHashCode();
- }
- }
-
- public object Id
- {
- get { return id;}
- }
-
- public string Role
- {
- get { return role; }
- }
-
- public override bool Equals(object obj)
- {
- ComponentCollectionKey rhs = obj as ComponentCollectionKey;
-
- if(rhs==null) return false;
-
- return this.Equals(rhs);
- }
-
- public bool Equals(ComponentCollectionKey obj)
- {
- // check for ref equality
- if(this==obj) return true;
-
- return (this.id.Equals(obj.Id)) && (this.role==obj.role);
- }
-
- public override string ToString()
- {
- return "Id=" + id.ToString() + " ; role=" + role;
- }
-
-
- }
-
- public void AddUnresolvedComponentCollection(object id, string role, PersistentCollection collection)
- {
- ComponentCollectionKey key = new ComponentCollectionKey(id, role);
-
- // I can't think of any valid reason that the same unresolved collection for a Component would
- // get in here twice...
- if( unresolvedComponentCollections.Contains(key) )
- {
- throw new HibernateException("There is a problem adding the collection identified by " + key.ToString());
- }
-
- unresolvedComponentCollections[key] = collection;
-
- }
-
- public PersistentCollection GetUnresolvedComponentCollection(object id, string role)
- {
- ComponentCollectionKey key = new ComponentCollectionKey(id, role);
- object returnValue = unresolvedComponentCollections[key];
- return returnValue==null ? null : (PersistentCollection) returnValue;
-
- }
-
- public void RemoveUnresolvedComponentCollection(object id, string role)
- {
- ComponentCollectionKey key = new ComponentCollectionKey(id, role);
- unresolvedComponentCollections.Remove(key);
- }
-
- #endregion
-
/// <summary>
/// add a collection we just loaded up (still needs initializing)
--- 3052,3055 ----
|