From: Richard B. <rb...@us...> - 2004-12-06 00:57:16
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27533 Modified Files: CPersistenceBroker.vb CPersistentObject.vb IPersistentObject.vb readme.html Log Message: A new interface IValidation has been created to allow validation checks on objects that do not inherit from CPersistentObject. It contains a single method - IsValid(). Index: readme.html =================================================================== RCS file: /cvsroot/jcframework/dotnet/readme.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- readme.html 16 Nov 2004 21:39:34 -0000 1.2 +++ readme.html 6 Dec 2004 00:57:06 -0000 1.3 @@ -186,6 +186,11 @@ <td class="col1">Performance </td> <td>Code has been added to allow various performance values to be measured in PerfMon. This includes cache hits, sql hits, retrieves, saves, deletes per second, etc. If you want more, just place a request on the web site.<td> </tr> + <tr valign="top"> + <td>N/A</td> + <td class="col1">Validation</td> + <td>A new interface IValidation has been created to allow validation checks on objects that do not inherit from CPersistentObject. It contains a single method - IsValid().<td> + </tr> </table> </div> </td> Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- CPersistenceBroker.vb 16 Nov 2004 21:39:34 -0000 1.80 +++ CPersistenceBroker.vb 6 Dec 2004 00:57:05 -0000 1.81 @@ -2274,8 +2274,11 @@ If Not obj.IsDirty Then Return queue 'Do not save if nothing changed End If If obj.IsProxy Then Return queue 'Do not save if object is proxied - If obj.GetObjectType.IsSubclassOf(GetType(CPersistentObject)) Then - If Not CType(obj, CPersistentObject).IsValid Then Return queue 'Do not save if object is not valid + 'If obj.GetObjectType.IsSubclassOf(GetType(CPersistentObject)) Then + ' If Not CType(obj, CPersistentObject).IsValid Then Return queue 'Do not save if object is not valid + 'End If + If GetType(IValidation).IsInstanceOfType(obj.GetSourceObject) Then + If Not CType(obj.GetSourceObject, IValidation).IsValid Then Return queue 'Do not save if object is not valid End If If obj.IsReadOnly Then Return queue @@ -2292,9 +2295,10 @@ 'But, countinue to determine if the object's associations need saving If includeBaseObject AndAlso _ (obj.IsDirty AndAlso Not obj.IsProxy AndAlso Not obj.IsReadOnly AndAlso Not obj.IsModifyOnly) Then - If obj.GetObjectType.IsSubclassOf(GetType(CPersistentObject)) Then - If CType(obj, CPersistentObject).IsValid Then 'Do not save if object is not valid - obj.IsDirty = False 'Added to queue so clear dirty flag + 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 queue.Enqueue(obj) End If Else Index: IPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/IPersistentObject.vb,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- IPersistentObject.vb 5 Nov 2004 01:39:17 -0000 1.7 +++ IPersistentObject.vb 6 Dec 2004 00:57:06 -0000 1.8 @@ -55,7 +55,6 @@ Sub Delete(ByVal obj As CPersistentObject, ByVal deleteSuperClass As Boolean) Sub DeleteAll() - Function IsValid() As Boolean Function IsReferenced() As Boolean Function getNewObject() As CPersistentObject @@ -64,3 +63,7 @@ Event LoadStarted As EventHandler Event LoadFinished As EventHandler End Interface + +Public Interface IValidation + Function IsValid() As Boolean +End Interface \ No newline at end of file Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- CPersistentObject.vb 5 Nov 2004 01:39:17 -0000 1.50 +++ CPersistentObject.vb 6 Dec 2004 00:57:05 -0000 1.51 @@ -27,6 +27,7 @@ Implements IEditableObject Implements IDataErrorInfo Implements IPersistentObject + Implements IValidation Private m_persistent As Boolean Private m_proxy As Boolean @@ -1136,7 +1137,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public MustOverride Function IsValid() As Boolean Implements IPersistentObject.IsValid + Public MustOverride Function IsValid() As Boolean Implements IValidation.IsValid '''----------------------------------------------------------------------------- ''' <summary> |