From: Richard B. <rb...@us...> - 2005-01-31 06:17:51
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9637 Modified Files: CConnection.vb CInjectedObject.vb readme.html Log Message: Fixed problem saving objects with 3+ levels of interface inheritance. Fixed problem with cache not being correctly restored after transaction rollback. Index: readme.html =================================================================== RCS file: /cvsroot/jcframework/dotnet/readme.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- readme.html 19 Dec 2004 22:43:17 -0000 1.5 +++ readme.html 31 Jan 2005 06:17:39 -0000 1.6 @@ -169,6 +169,16 @@ <td class="col1">Missing parameters</td> <td>Update statements were being generated with missing parameters. This only occurred when parameters for the where clause had NULL values and when ANSI null handling was on.<td> </tr> + <tr valign="top"> + <td>N/A</td> + <td class="col1">Rollback on transaction did not restore cache</td> + <td>Cache entries were not being correctly restored when a transaction was rolled back.<td> + </tr> + <tr valign="top"> + <td>N/A</td> + <td class="col1">Problem saving with 3 or more levels of interface inheritance</td> + <td>Only the lowest and highest mapped interfaces were being saved when an object with 3+ levels of interface inheritances was persisted.<td> + </tr> <tr class="tableCaption" valign="bottom"> <td colspan=3><br/>Modifications</td> </tr> Index: CConnection.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CConnection.vb,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- CConnection.vb 23 Dec 2004 01:14:44 -0000 1.30 +++ CConnection.vb 31 Jan 2005 06:17:39 -0000 1.31 @@ -506,9 +506,9 @@ If m_transactioncalls = 1 Then Try m_transaction.Rollback() - getPersistenceBrokerInstance().rollbackCache(Me) Catch ex As Exception End Try + getPersistenceBrokerInstance().rollbackCache(Me.Database) Me.Started = False m_transaction = Nothing End If @@ -986,9 +986,9 @@ If m_transactioncalls = 1 Then Try m_transaction.Rollback() - getPersistenceBrokerInstance().rollbackCache(Me) Catch ex As Exception End Try + getPersistenceBrokerInstance().rollbackCache(Me.Database) Me.Started = False m_transaction = Nothing End If @@ -1475,9 +1475,9 @@ If m_transactioncalls = 1 Then Try m_transaction.Rollback() - getPersistenceBrokerInstance().rollbackCache(Me) Catch ex As Exception End Try + getPersistenceBrokerInstance().rollbackCache(Me.Database) Me.Started = False m_transaction = Nothing End If @@ -1900,9 +1900,9 @@ If m_transactioncalls = 1 Then Try m_transaction.Rollback() - getPersistenceBrokerInstance().rollbackCache(Me) Catch ex As Exception End Try + getPersistenceBrokerInstance().rollbackCache(Me.Database) Me.Started = False m_transaction = Nothing End If @@ -2351,9 +2351,9 @@ If m_transactioncalls = 1 Then Try m_transaction.Rollback() - getPersistenceBrokerInstance().rollbackCache(Me) Catch ex As Exception End Try + getPersistenceBrokerInstance().rollbackCache(Me.Database) Me.Started = False m_transaction = Nothing End If Index: CInjectedObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CInjectedObject.vb 16 Nov 2004 21:39:34 -0000 1.8 +++ CInjectedObject.vb 31 Jan 2005 06:17:39 -0000 1.9 @@ -103,21 +103,68 @@ ClassMap = getClassMap(TypeName(m_object), m_object.GetType.FullName) If ClassMap Is Nothing Then 'try to find an interface that is mapped - first mapped interface we find will be used - Dim intType, interfaces() As Type + Dim intType, tmpType, interfaces() As Type interfaces = m_object.GetType.GetInterfaces - For Each intType In interfaces - tmpCMap = getClassMap(intType.Name, intType.FullName) - 'If this class has children, iterate through other class maps to see if - 'the object inherits a child class, otherwise we can get the wrong class map - 'returned. - If Not tmpCMap Is Nothing Then - If ClassMap Is Nothing Then ClassMap = tmpCMap - If tmpCMap.ChildrenMaps.Count = 0 Then - ClassMap = tmpCMap - Exit For + + '----------------------------------------- + Dim n, m As Integer + Dim super As CClassMap + + ' get the super class map if the object has multi-level inheritance + For n = 0 To interfaces.Length - 1 + ClassMap = getClassMap(interfaces(n).Name, interfaces(n).FullName) + If (Not ClassMap Is Nothing) AndAlso ClassMap.SuperClass Is Nothing Then + super = ClassMap + For m = n To interfaces.Length - 2 + interfaces(m) = interfaces(m + 1) + Next + If interfaces.Length > 1 Then + interfaces(m) = Nothing End If + Exit For End If Next + + 'get actual interface which is the bottom level of inheritance + n = 0 + While n < interfaces.Length - 1 + If Not interfaces(n) Is Nothing Then + tmpCMap = getClassMap(interfaces(n).Name, interfaces(n).FullName) + If (Not tmpCMap Is Nothing) AndAlso tmpCMap.SuperClass Is super Then + super = tmpCMap + ClassMap = super + For m = n To interfaces.Length - 2 + interfaces(m) = interfaces(m + 1) + Next + interfaces(m) = Nothing + + If interfaces(0) Is Nothing Then + ClassMap = tmpCMap + Exit While + End If + n = 0 + Else + n = n + 1 + End If + Else + n = n + 1 + End If + End While + '----------------------------------------- + + 'For Each intType In interfaces + ' tmpCMap = getClassMap(intType.Name, intType.FullName) + ' 'If this class has children, iterate through other class maps to see if + ' 'the object inherits a child class, otherwise we can get the wrong class map + ' 'returned. + ' If Not tmpCMap Is Nothing Then + ' If ClassMap Is Nothing Then ClassMap = tmpCMap + ' If tmpCMap.ChildrenMaps.Count = 0 Then + ' ClassMap = tmpCMap + ' Exit For + ' End If + ' End If + 'Next End If If (ClassMap Is Nothing) Then Throw New NoClassMapException("No class map for " & m_object.GetType.FullName) |