From: Richard B. <rb...@us...> - 2005-02-06 02:48:56
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3728 Modified Files: Tag: v2_0 AtomsFramework.xml CCacheEntry.vb CPersistenceBroker.vb Log Message: Fix in the cache for precopying collections that haven't been initialized. Fix for multi retrieve criteria when using 3+ level class hierarchies Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.89 retrieving revision 1.89.2.1 diff -u -d -r1.89 -r1.89.2.1 --- CPersistenceBroker.vb 2 Feb 2005 05:08:37 -0000 1.89 +++ CPersistenceBroker.vb 6 Feb 2005 02:48:36 -0000 1.89.2.1 @@ -776,8 +776,11 @@ If udaMap.LazyLoad Then cursor.loadProxy(anObjPers.GetSourceObject) Else - cursor.loadObject(anObjPers.GetSourceObject) - retrieveAssociations(anObjPers, conn, anObjPers.GetClassMap, useCache) + cursor.loadObject(anObjPers.GetSourceObject) + 'To prevent recursive associations causing problems we need to add the + 'object to the cache here as a preliminary measure + m_cache.Add(anObjPers) + retrieveAssociations(anObjPers, conn, anObjPers.GetClassMap, useCache) End If anObjPers.IsDirty = False 'After populating a new object anObjPers.OriginalCacheKey = New CCacheKey(anObjPers) Index: CCacheEntry.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CCacheEntry.vb,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -u -d -r1.25.2.1 -r1.25.2.2 --- CCacheEntry.vb 4 Feb 2005 04:46:08 -0000 1.25.2.1 +++ CCacheEntry.vb 6 Feb 2005 02:48:36 -0000 1.25.2.2 @@ -130,35 +130,41 @@ Dim value As Object 'We must precopy this collection into the collection copy 'A simple assignment would just copy a reference to the colletion, while 'we need to copy the collection itself, so that adding/removing elements 'of the original won't effect the copy - m_collectionCollection = New Specialized.HybridDictionary t = m_object.GetObjectType - fields = t.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) + m_collectionCollection = New Specialized.HybridDictionary t = m_object.GetObjectType + fields = t.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) For Each f In fields iListType = f.FieldType.GetInterface("IList", True) iDicType = f.FieldType.GetInterface("IDictionary", True) - 'iEnumerableType = f.FieldType.GetInterface("IEnumerable", True) - If Not iListType Is Nothing OrElse Not iDicType Is Nothing Then - Dim ICloneType As Type = f.FieldType.GetInterface("ICloneable", True) - If Not ICloneType Is Nothing Then - 'Getting the ICloneable interface from the object. - Dim IClone As ICloneable = CType(f.GetValue(m_object), ICloneable) - 'We use the clone method to set the new value to the field. - coll = IClone.Clone() - Else - 'If the field doesn't support the ICloneable interface then just set it. - coll = Activator.CreateInstance(f.FieldType) 'need to copy references one-by-one - If Not iListType Is Nothing Then - il = CType(coll, IList) - For Each obj In f.GetValue(m_object.GetSourceObject) - il.Add(obj) - Next - Else - id = CType(coll, IDictionary) - For Each de As DictionaryEntry In f.GetValue(m_object.GetSourceObject) - id.Add(de.Key, de.Value) - Next - End If - End If - m_collectionCollection.Add(f.Name, coll) End If Next + If Not iListType Is Nothing OrElse Not iDicType Is Nothing Then + Dim ICloneType As Type = f.FieldType.GetInterface("ICloneable", True) + If Not ICloneType Is Nothing Then + 'Getting the ICloneable interface from the object. + If Not f.GetValue(m_object.GetSourceObject) Is Nothing Then + Dim IClone As ICloneable = CType(f.GetValue(m_object.GetSourceObject), ICloneable) + coll = IClone.Clone() + Else + coll = Nothing + End If + Else + If Not f.GetValue(m_object.GetSourceObject) Is Nothing Then + 'If the field doesn't support the ICloneable interface then just set it. + coll = Activator.CreateInstance(f.FieldType) 'need to copy references one-by-one + If Not iListType Is Nothing Then + il = CType(coll, IList) + For Each obj In f.GetValue(m_object.GetSourceObject) + il.Add(obj) + Next + Else + id = CType(coll, IDictionary) + For Each de As DictionaryEntry In f.GetValue(m_object.GetSourceObject) + id.Add(de.Key, de.Value) + Next + End If + Else + coll = Nothing + End If + End If + m_collectionCollection.Add(f.Name, coll) End If Next End Sub Public Sub RestoreCollections() Index: AtomsFramework.xml =================================================================== RCS file: /cvsroot/jcframework/dotnet/AtomsFramework.xml,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -d -r1.8 -r1.8.2.1 --- AtomsFramework.xml 16 Aug 2004 04:16:54 -0000 1.8 +++ AtomsFramework.xml 6 Feb 2005 02:48:36 -0000 1.8.2.1 @@ -1,7270 +1,7258 @@ -<?xml version="1.0"?> -<doc> - <assembly> - <name>AToMSFramework</name> - <version>1.22.0.0</version> - <fullname>AToMSFramework, Version=1.22.0.0, Culture=neutral, PublicKeyToken=e5c3a6c915b93944</fullname> - </assembly> - <members> - <member name="T:AToMSFramework.AFTableAttribute"> - <summary> - Custom attribute to define table mappings for a class [...14497 lines suppressed...] + <history> + [rbanks] 18/12/2003 Created + </history></member><member name="T:AToMSFramework.modOIDFactorySingleton"><summary> + Module for managing the ObjectID Factory singleton object + </summary> + <remarks>Manages the references to the singleton <see cref="T:AToMSFramework.COIDFactory" /> object.</remarks> + <history> + [rbanks] 18/12/2003 Created + </history></member><member name="M:AToMSFramework.modOIDFactorySingleton.getOIDFactoryInstance"><summary> + Gets a reference to the COIDFactory instance. + </summary> + <returns>A reference to the COIDFactory object.</returns> + <remarks>If the <see cref="T:AToMSFramework.COIDFactory" /> instance does not yet + exist it is created.</remarks> + <history> + [rbanks] 18/12/2003 Created + </history></member></remarks></member> + </members> </doc> \ No newline at end of file |