From: Dan M. <dan...@us...> - 2004-12-21 08:52:57
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4418/dotnet Modified Files: CPersistenceBroker.vb Log Message: Add a test case to check that for an inherited child class that has an association defined in the XML mapping file, and does not have an instance of the association in the database, the framework does not create the object in the association. Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- CPersistenceBroker.vb 19 Dec 2004 23:04:56 -0000 1.84 +++ CPersistenceBroker.vb 21 Dec 2004 08:52:46 -0000 1.85 @@ -698,6 +698,7 @@ Dim ValueVar As String Dim tmpOIDValue As String Dim gotValue As Boolean + Dim found As Boolean Dim col As IList Dim myKeys(cm.AssociationMaps.Count) As String cm.AssociationMaps.Keys.CopyTo(myKeys, 0) @@ -740,17 +741,20 @@ Next j anObjPers = m_cache.Item(Value) If anObjPers Is Nothing Then - retrieveObject(Value, False, False) + found = retrieveObject(Value, False, False) Else Value = anObjPers + found = True Try PCCacheHits.Increment() Catch End Try End If - Value.IsDirty = False 'After populating a new object - Value.OriginalCacheKey = New CCacheKey(Value) - obj.SetAttributeValue(udaMap.Target, Value.GetSourceObject) + If found Then + Value.IsDirty = False 'After populating a new object + Value.OriginalCacheKey = New CCacheKey(Value) + obj.SetAttributeValue(udaMap.Target, Value.GetSourceObject) + End If End If End If ElseIf udaMap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_MANY Then @@ -2335,7 +2339,7 @@ 'retrieveAssociations(obj, conn, classMap, True) 'obj.IsLoading = False If obj.Persistent Then - obj.AssociationsLoaded = True + 'obj.AssociationsLoaded = True obj.IsDirty = False obj.OriginalCacheKey = New CCacheKey(obj) End If @@ -2425,7 +2429,7 @@ Return queue End If If includeBaseObject Then - obj.IsDirty = False 'Added to queue so clear dirty flag + 'obj.IsDirty = False 'Added to queue so clear dirty flag queue.Enqueue(obj) End If Else @@ -2436,11 +2440,11 @@ If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then 'If obj.GetObjectType.IsSubclassOf(GetType(CPersistentObject)) Then If CType(obj.GetSourceObject, IValidation).IsValid Then 'Do not save if object is not valid - obj.IsDirty = False 'Added to queue so clear dirty flag + 'obj.IsDirty = False 'Added to queue so clear dirty flag queue.Enqueue(obj) End If Else - obj.IsDirty = False + 'obj.IsDirty = False queue.Enqueue(obj) End If End If |