From: Richard B. <rb...@us...> - 2005-03-01 01:28:33
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24860 Modified Files: CPersistenceBroker.vb CPersistentObject.vb IPersistentObject.vb Log Message: Added IsValidToDelete to IValidation interface Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.96 retrieving revision 1.97 diff -u -d -r1.96 -r1.97 --- CPersistenceBroker.vb 28 Feb 2005 23:07:53 -0000 1.96 +++ CPersistenceBroker.vb 1 Mar 2005 01:28:19 -0000 1.97 @@ -1141,6 +1141,14 @@ clMap = obj.GetClassMap cm = clMap + + If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then + If Not CType(obj.GetSourceObject, IValidation).IsValidToDelete Then + Debug.WriteLine("Not valid to delete object") + Return 'Do not delete if object + End If + End If + Debug.WriteLine("Deleting object " & cm.Name) Dim myKeys(cm.AssociationMaps.Count) As String cm.AssociationMaps.Keys.CopyTo(myKeys, 0) Index: IPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/IPersistentObject.vb,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- IPersistentObject.vb 6 Dec 2004 00:57:06 -0000 1.8 +++ IPersistentObject.vb 1 Mar 2005 01:28:19 -0000 1.9 @@ -66,4 +66,5 @@ Public Interface IValidation Function IsValid() As Boolean + Function IsValidToDelete() As Boolean End Interface \ No newline at end of file Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- CPersistentObject.vb 28 Feb 2005 23:07:54 -0000 1.56 +++ CPersistentObject.vb 1 Mar 2005 01:28:19 -0000 1.57 @@ -1156,6 +1156,26 @@ '''----------------------------------------------------------------------------- ''' <summary> + ''' Checks that an object can be deleted + ''' </summary> + ''' <returns>Boolean indicating wether the object is may be deleted</returns> + ''' <remarks>This function indicates wether + ''' the object is in a state where it can be deleted from the database or not. + ''' <para>This can also be a place for object association integrity checks to occur</para> + ''' <para>Returning a false will prevent the object from being deleted when the delete + ''' method is called. True allows to the object to be deleted and is the normal + ''' behaviour unless the method is overridden.</para> + ''' </remarks> + ''' <history> + ''' [rbanks] 26/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + Public Overridable Function IsValidToDelete() As Boolean Implements IValidation.IsValidToDelete + Return True + End Function + + '''----------------------------------------------------------------------------- + ''' <summary> ''' Determines wether two objects are equivalent by comparing their key values. ''' </summary> ''' <param name="obj">The second object to be compared</param> |