Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv815 Modified Files: AFCustomAttributes.vb AFExceptions.vb AToMSFramework.sln AToMSFramework.vbproj AssemblyInfo.vb AtomsFramework.ndoc AtomsFramework.snk AtomsFramework.xml CAssociationKey.vb CAssociationObject.vb CAssociationState.vb CAssociationTable.vb CAttributeMap.vb CBetweenCriteria.vb CCacheEntry.vb CClassMap.vb CColumnMap.vb CConnection.vb CCriteriaCondition.vb CCursor.vb CDatabaseMap.vb CDeleteCriteria.vb CEqualToCriteria.vb CGreaterThanCriteria.vb CGreaterThanOrEqualToCriteria.vb CInCriteria.vb CInjectedObject.vb CInjectedObjects.vb CJoin.vb CLessThanCriteria.vb CLessThanOrEqualToCriteria.vb CLikeCriteria.vb CMultiRetrieveCriteria.vb CMultiSummaryCriteria.vb CNotBetweenCriteria.vb CNotEqualToCriteria.vb CNotInCrieteria.vb COID.vb COIDFactory.vb COrderEntry.vb CPersistenceBroker.vb CPersistentCollection.vb CPersistentCriteria.vb CPersistentObject.vb CQueuedDelete.vb CRelationalDatabase.vb CResultset.vb CRetrieveCriteria.vb CSelectInCriteria.vb CSelectInListCriteria.vb CSelectionCriteria.vb CSqlStatement.vb CSummaryCriteria.vb CTableMap.vb CTransaction.vb CUDAMap.vb CUDAMapEntry.vb CXMLConfigLoader.vb IConfigLoader.vb IPersistentObject.vb IniFiles.vb XMLMapping.xsd XMLMapping.xsx modAliasNull.vb modPersistenceBrokerSingleton.vb Log Message: Name changes to bring class library into line with Microsoft naming standards. FxCop directory added Nunit tests moved into main repository Index: modAliasNull.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/modAliasNull.vb,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- modAliasNull.vb 7 Feb 2005 07:37:35 -0000 1.7 +++ modAliasNull.vb 11 Apr 2005 00:31:44 -0000 1.8 @@ -2,7 +2,7 @@ Option Explicit On '''----------------------------------------------------------------------------- -''' Project : AToMSFramework +''' Project : Atoms.Framework ''' Module : modAliasNull ''' '''----------------------------------------------------------------------------- @@ -15,7 +15,7 @@ ''' [rbanks] 18/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- -Public Module modAliasNull +Public Module ModAliasNull '----------------------------------------------------------- 'VBPJ Junio 2000 @@ -30,18 +30,18 @@ '----------------------------------------------------------- - Public Const NULL_INTEGER As Short = -32767 '-32768 - Public Const NULL_LONG As Double = -2147483647.0# '-2147483648# - Public Const NULL_SINGLE As Double = -3.402823E+38 - Public Const NULL_DOUBLE As Double = -1.7976931348623E+308 - Public Const NULL_CURRENCY As Double = -922337203685477.0# - Public Const NULL_STRING As String = "" - Public Const NULL_DATE As Date = #1/1/0100# - Public Const NULL_BYTE As Short = 0 + Public Const NullInteger As Short = -32767 '-32768 + Public Const NullLong As Double = -2147483647.0# '-2147483648# + Public Const NullSingle As Double = -3.402823E+38 + Public Const NullDouble As Double = -1.7976931348623E+308 + Public Const NullCurrency As Double = -922337203685477.0# + Public Const NullString As String = "" + Public Const NullDate As Date = #1/1/0100# + Public Const NullByte As Short = 0 'Constantes para devolver DATE y NOW - Public Const DEFAULT_DATE As Date = #1/1/0101# - Public Const DEFAULT_NOW As Date = #1/1/0101 1:01:01 AM# + Public Const DefaultDate As Date = #1/1/0101# + Public Const DefaultNow As Date = #1/1/0101 1:01:01 AM# '''----------------------------------------------------------------------------- ''' <summary> @@ -56,34 +56,34 @@ ''' [rbanks] 18/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function IsNullAlias(ByVal InValue As Object) As Boolean + Public Function IsNullAlias(ByVal inValue As Object) As Boolean Dim blnValue As Boolean blnValue = False - Select Case VarType(InValue) + Select Case VarType(inValue) Case VariantType.Short - If InValue = NULL_INTEGER Then blnValue = True + If inValue = NullInteger Then blnValue = True Case VariantType.Integer - If InValue = NULL_LONG Then blnValue = True + If inValue = NullLong Then blnValue = True Case VariantType.Single - If InValue = NULL_SINGLE Then blnValue = True + If inValue = NullSingle Then blnValue = True Case VariantType.Double - If InValue = NULL_DOUBLE Then blnValue = True + If inValue = NullDouble Then blnValue = True Case VariantType.Decimal - If InValue = NULL_CURRENCY Then blnValue = True + If inValue = NullCurrency Then blnValue = True Case VariantType.String - If InValue Is Nothing Then + If inValue Is Nothing Then blnValue = True End If Case VariantType.Byte - If InValue = NULL_BYTE Then blnValue = True + If inValue = NullByte Then blnValue = True Case VariantType.DataObject.Null blnValue = True Case Else - If InValue Is Nothing Then + If inValue Is Nothing Then blnValue = True Else - If IsDBNull(InValue) Then + If IsDBNull(inValue) Then blnValue = True End If End If @@ -91,6 +91,9 @@ Return blnValue End Function + Public Sub NullToAlias(ByVal inValue As Object, ByRef outValue As Object) + Call NullToAlias(inValue, outValue, Nothing) + End Sub ' Replaces a Null value with an application defined null value. ' For example, instead of a Date being Null, an alias null @@ -113,50 +116,50 @@ ''' [rbanks] 18/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Sub NullToAlias(ByVal InValue As Object, ByRef OutValue As Object, Optional ByRef Override As Object = Nothing) + Public Sub NullToAlias(ByVal inValue As Object, ByRef outValue As Object, ByRef override As Object) Dim vntOutValue As Object ' If the InValue is not Null, then just return that value - If Override Is Nothing Then - Override = System.DBNull.Value + If override Is Nothing Then + override = System.DBNull.Value End If - If Not IsDBNull(InValue) Then - vntOutValue = InValue + If Not IsDBNull(inValue) Then + vntOutValue = inValue ' Otherwise, check if we are to override the Null out value ' If not, then return a null alias specific for the variable type - ElseIf IsDBNull(Override) Then - Select Case VarType(OutValue) + ElseIf IsDBNull(override) Then + Select Case VarType(outValue) Case VariantType.Short - vntOutValue = CShort(NULL_INTEGER) + vntOutValue = CShort(NullInteger) Case VariantType.Integer - vntOutValue = CInt(NULL_LONG) + vntOutValue = CInt(NullLong) Case VariantType.Single - vntOutValue = CSng(NULL_SINGLE) + vntOutValue = CSng(NullSingle) Case VariantType.Double - vntOutValue = CDbl(NULL_DOUBLE) + vntOutValue = CDbl(NullDouble) Case VariantType.Decimal - vntOutValue = CDec(NULL_CURRENCY) + vntOutValue = CDec(NullCurrency) Case VariantType.String - vntOutValue = CStr(NULL_STRING) + vntOutValue = CStr(NullString) Case VariantType.Date - vntOutValue = CDate(NULL_DATE) + vntOutValue = CDate(NullDate) Case VariantType.Byte - vntOutValue = CByte(NULL_BYTE) + vntOutValue = CByte(NullByte) Case VariantType.Boolean vntOutValue = CBool(False) Case Else End Select ' Otherwise, return the Null override value Else - vntOutValue = Override + vntOutValue = override End If - OutValue = vntOutValue + outValue = vntOutValue End Sub - - - + Public Function AliasToNull(ByVal inValue As Object) As Object + Return AliasToNull(inValue, Nothing) + End Function ' Replaces an application defined null value with a ' true VB Null value. For example, a Date with a value @@ -176,34 +179,34 @@ ''' [rbanks] 18/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function AliasToNull(ByVal InValue As Object, Optional ByRef NullValue As Object = Nothing) As Object + Public Function AliasToNull(ByVal inValue As Object, ByRef nullValue As Object) As Object Dim vntOutValue As Object - If NullValue Is Nothing Then - NullValue = System.DBNull.Value + If nullValue Is Nothing Then + nullValue = System.DBNull.Value End If - vntOutValue = InValue - Select Case VarType(InValue) + vntOutValue = inValue + Select Case VarType(inValue) Case VariantType.Short - If InValue = NULL_INTEGER Then vntOutValue = NullValue + If inValue = NullInteger Then vntOutValue = nullValue Case VariantType.Integer - If InValue = NULL_LONG Then vntOutValue = NullValue + If inValue = NullLong Then vntOutValue = nullValue Case VariantType.Single - If InValue = NULL_SINGLE Then vntOutValue = NullValue + If inValue = NullSingle Then vntOutValue = nullValue Case VariantType.Double - If InValue = NULL_DOUBLE Then vntOutValue = NullValue + If inValue = NullDouble Then vntOutValue = nullValue Case VariantType.Decimal - If InValue = NULL_CURRENCY Then vntOutValue = NullValue + If inValue = NullCurrency Then vntOutValue = nullValue Case VariantType.String - If Trim(InValue) = NULL_STRING Then - vntOutValue = NullValue + If Trim(inValue) = NullString Then + vntOutValue = nullValue Else - vntOutValue = Trim(InValue) + vntOutValue = Trim(inValue) End If Case VariantType.Date - If InValue = NULL_DATE Then vntOutValue = NullValue + If inValue = NullDate Then vntOutValue = nullValue Case VariantType.Byte - If InValue = NULL_BYTE Then vntOutValue = 0 + If inValue = NullByte Then vntOutValue = 0 Case Else ' Debug.Assert False End Select @@ -220,18 +223,18 @@ ''' <remarks>The calculation is based on a period (".") and will need ''' reworking in locales where the decimal is the thousands separator and ''' a comma is used for the decimal. - ''' <para>The function is unused by the AtomsFramework.</para></remarks> + ''' <para>The function is unused by the Atoms.Framework.</para></remarks> ''' <history> ''' [rbanks] 18/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function NumberOfDecimals(ByRef InNumber As Object) As Short + Public Function NumberOfDecimals(ByRef inNumber As Object) As Short ' finds the length of the string after the first decimal Dim iPos As Short Dim strTemp As String - If IsNumeric(InNumber) Then - strTemp = CStr(InNumber) + If IsNumeric(inNumber) Then + strTemp = CStr(inNumber) iPos = InStr(1, Trim(strTemp), ".") If iPos > 0 Then NumberOfDecimals = strTemp.Length - iPos @@ -252,19 +255,19 @@ ''' <remarks>The calculation is based on a period (".") and will need ''' reworking in locales where the decimal is the thousands separator and ''' a comma is used for the decimal. - ''' <para>The function is unused by the AtomsFramework.</para></remarks> + ''' <para>The function is unused by the Atoms.Framework.</para></remarks> ''' <history> ''' [rbanks] 18/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function NumberOfDigits(ByRef InNumber As Object) As Short + Public Function NumberOfDigits(ByRef inNumber As Object) As Short ' finds the length of the string after the first decimal Dim iPos As Short Dim strTemp As String Dim iNum As Short - If IsNumeric(InNumber) Then - strTemp = CStr(InNumber) + If IsNumeric(inNumber) Then + strTemp = CStr(inNumber) ' Only count digits to left of decimal point iPos = InStr(1, LTrim(strTemp), ".") If iPos > 0 Then Index: AToMSFramework.vbproj =================================================================== RCS file: /cvsroot/jcframework/dotnet/AToMSFramework.vbproj,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- AToMSFramework.vbproj 21 Mar 2005 08:05:08 -0000 1.25 +++ AToMSFramework.vbproj 11 Apr 2005 00:31:41 -0000 1.26 @@ -9,7 +9,7 @@ <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" - AssemblyName = "AToMSFramework" + AssemblyName = "AtomsFramework" AssemblyOriginatorKeyFile = "" AssemblyOriginatorKeyMode = "None" DefaultClientScript = "JScript" @@ -20,8 +20,8 @@ OptionCompare = "Binary" OptionExplicit = "On" OptionStrict = "Off" - RootNamespace = "AToMSFramework" - StartupObject = "AToMSFramework.(None)" + RootNamespace = "AtomsFramework" + StartupObject = "AtomsFramework.(None)" > <Config Name = "Debug" @@ -69,22 +69,13 @@ Name = "System.XML" AssemblyName = "System.Xml" /> - <Reference - Name = "Microsoft.VisualBasic.Compatibility" - AssemblyName = "Microsoft.VisualBasic.Compatibility" - /> - <Reference - Name = "Microsoft.VisualBasic.Compatibility.Data" - AssemblyName = "Microsoft.VisualBasic.Compatibility.Data" - /> </References> <Imports> - <Import Namespace = "Microsoft.VisualBasic" /> - <Import Namespace = "Microsoft.VisualBasic.Compatibility" /> <Import Namespace = "System" /> <Import Namespace = "System.Collections" /> <Import Namespace = "System.Data" /> <Import Namespace = "System.Diagnostics" /> + <Import Namespace = "Microsoft.VisualBasic" /> </Imports> </Build> <Files> @@ -339,11 +330,6 @@ BuildAction = "Compile" /> <File - RelPath = "CTransaction.vb" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "CUDAMap.vb" SubType = "Code" BuildAction = "Compile" @@ -369,11 +355,6 @@ BuildAction = "Compile" /> <File - RelPath = "IniFiles.vb" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "IPersistentObject.vb" SubType = "Code" BuildAction = "Compile" Index: IPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/IPersistentObject.vb,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- IPersistentObject.vb 4 Apr 2005 01:27:29 -0000 1.14 +++ IPersistentObject.vb 11 Apr 2005 00:31:44 -0000 1.15 @@ -3,24 +3,24 @@ Property IsProxy() As Boolean Property IsDirty() As Boolean Property ExpiryInterval() As Double - Property OIDValue() As String - Property GUIDValue() As String + Property OidValue() As String + Property GuidValue() As String Property AssociationsLoaded() As Boolean Property IsLoading() As Boolean Property IsQueued() As Boolean ReadOnly Property IsReadOnly() As Boolean ReadOnly Property IsModifyOnly() As Boolean - Property OriginalCacheKey() As CCacheKey + Property OriginalCacheKey() As CacheKey Property State() As PersistenceState - Function GetClassMap() As CClassMap - Function GetFieldLengthByName(ByVal x As String) As Integer - Function GetFieldTypeByName(ByVal x As String) As Type + Function GetClassMap() As ClassMap + Function GetFieldLengthByName(ByVal propertyName As String) As Integer + Function GetFieldTypeByName(ByVal propertyName As String) As Type - Function GetCollectionByAttribute(ByVal pName As String) As IList - Function GetObjectByAttribute(ByVal pName As String) As IPersistableObject - Function GetValueByAttribute(ByVal pName As String) As Object - Sub SetAttributeValue(ByVal pName As String, ByRef Value As Object) + Function GetCollectionByAttribute(ByVal name As String) As IList + Function GetObjectByAttribute(ByVal name As String) As IPersistableObject + Function GetValueByAttribute(ByVal name As String) As Object + Sub SetAttributeValue(ByVal name As String, ByRef value As Object) Function GetRemovedCollectionItems(ByVal propertyName As String) As Collection Sub CopyOneToManyCollections() @@ -29,7 +29,7 @@ Function Equals(ByVal obj As IPersistableObject) As Boolean Function Copy() As IPersistableObject Sub ReplaceWith(ByVal obj As IPersistableObject, ByVal copyEventHandlers As Boolean) - Function GetObjectByClassMap(ByVal classMap As CClassMap) As IPersistableObject + Function GetObjectByClassMap(ByVal classMap As ClassMap) As IPersistableObject Function GetSourceObject() As Object Function HasValidKey() As Boolean Function IsIPersistentObject() As Boolean @@ -45,26 +45,26 @@ Sub ResetOriginalDates() Function Retrieve() As Boolean - Function Retrieve(ByRef obj As CPersistentObject) As Boolean - Function Retrieve(ByRef obj As CPersistentObject, ByVal usecache As Boolean) As Boolean + Function Retrieve(ByRef obj As PersistentObject) As Boolean + Function Retrieve(ByRef obj As PersistentObject, ByVal useCache As Boolean) As Boolean Function Find() As Boolean - Function Find(ByRef obj As CPersistentObject) As Boolean - Function Find(ByRef obj As CPersistentObject, ByVal usecache As Boolean) As Boolean + Function Find(ByRef obj As PersistentObject) As Boolean + Function Find(ByRef obj As PersistentObject, ByVal useCache As Boolean) As Boolean Sub Save() Sub Save(ByVal checkAssociationsRecursively As Boolean) - Sub Save(ByVal obj As CPersistentObject, ByVal checkAssociationsRecursivly As Boolean) + Sub Save(ByVal obj As PersistentObject, ByVal checkAssociationsRecursively As Boolean) Sub Delete() Sub Delete(ByVal deleteSuperClass As Boolean) - Sub Delete(ByVal obj As CPersistentObject) - Sub Delete(ByVal obj As CPersistentObject, ByVal deleteSuperClass As Boolean) + Sub Delete(ByVal obj As PersistentObject) + Sub Delete(ByVal obj As PersistentObject, ByVal deleteSuperClass As Boolean) Sub DeleteAll() Function IsReferenced() As Boolean - Function getNewObject() As CPersistentObject + Function GetNewObject() As PersistentObject Event MarkedAsDirty As EventHandler Event LoadStarted As EventHandler Index: COIDFactory.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/COIDFactory.vb,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- COIDFactory.vb 25 Oct 2004 07:12:31 -0000 1.4 +++ COIDFactory.vb 11 Apr 2005 00:31:43 -0000 1.5 @@ -1,21 +1,21 @@ Option Explicit On '''----------------------------------------------------------------------------- -''' Project : AToMSFramework -''' Class : COIDFactory +''' Project : Atoms.Framework +''' Class : OIDFactory ''' '''----------------------------------------------------------------------------- ''' <summary> ''' Class used to generate object ID's ''' </summary> -''' <remarks>This class is used to generate new <see cref="T:AToMSFramework.COID">object ids</see> +''' <remarks>This class is used to generate new <see cref="T:Atoms.Framework.OID">object ids</see> ''' and manages the pool of B-values for a single session id (the A value). When the ''' pool is exhausted a new session id is retrieved and the pool is reset.</remarks> ''' <history> ''' [rbanks] 12/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- -Public Class COIDFactory +Public Class ObjectIdFactory Private m_nextAValue As Integer Private m_nextBValue As Short @@ -25,50 +25,50 @@ ''' <summary> ''' Creates and returns a new object id ''' </summary> - ''' <returns>A new populated COID object</returns> + ''' <returns>A new populated OID object</returns> ''' <remarks>Each time this function is called, the B counter is incremented.</remarks> ''' <history> ''' [rbanks] 12/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function newOID() As COID - Dim oid As New COID - oid.AValue = fetchAValue() + Public Function NewOid() As ObjectId + Dim oidvalue As New ObjectId + oidvalue.AValue = FetchAValue() Try m_nextBValue += 1S Catch m_fetchedAValue = False - oid.AValue = fetchAValue() ' get a new A value - m_nextBValue = 1 'reset the b values + oidvalue.AValue = FetchAValue() ' get a new A value + m_nextBValue = 1 'reset the b values End Try - oid.BValue = m_nextBValue - Return oid + oidvalue.BValue = m_nextBValue + Return oidvalue End Function '''----------------------------------------------------------------------------- ''' <summary> ''' Retrieves the A-Value ''' </summary> - ''' <returns>The current A value to use in creating new COID objects</returns> + ''' <returns>The current A value to use in creating new OID objects</returns> ''' <remarks>If no value is set the database OID table will be queried for the ''' next free A value and this will be returned, otherwise the current A value will be returned.</remarks> ''' <history> ''' [rbanks] 12/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Private Function fetchAValue() As Integer - Static persistenceBroker As CPersistenceBroker - Dim tmp As Integer + Private Function FetchAValue() As Integer + Static persistenceBroker As persistenceBroker + 'Dim tmp As Integer Dim de As DictionaryEntry - Dim reldb As _CRelationalDatabase + Dim reldb As IRelationalDatabase If m_fetchedAValue = False Then - persistenceBroker = getPersistenceBrokerInstance() + persistenceBroker = GetPersistenceBrokerInstance() For Each de In persistenceBroker.Databases - reldb = CType(de.Value, _CRelationalDatabase) + reldb = CType(de.Value, IRelationalDatabase) 'Just use the first database with an OID setting to get the AValue - If reldb.OIDTable.Length > 0 Then - m_nextAValue = reldb.getNextOIDAValue + If reldb.OidTable.Length > 0 Then + m_nextAValue = reldb.GetNextOidAValue Exit For End If Next @@ -77,19 +77,4 @@ Return m_nextAValue End Function - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Creates a new instance of the COIDFactory - ''' </summary> - ''' <remarks>The A and B counters are set to 0. No A-value will be - ''' available until the first COID object is generated.</remarks> - ''' <history> - ''' [rbanks] 12/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - Public Sub New() - m_fetchedAValue = False - m_nextAValue = 0 - m_nextBValue = 0 - End Sub End Class Index: CSelectionCriteria.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CSelectionCriteria.vb,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CSelectionCriteria.vb 21 Jul 2004 02:55:38 -0000 1.8 +++ CSelectionCriteria.vb 11 Apr 2005 00:31:44 -0000 1.9 @@ -6,19 +6,19 @@ ''' Interface that all selection criteria objects must implement. ''' </summary> '''----------------------------------------------------------------------------- -Public Interface _CSelectionCriteria - Property AttrMap() As CAttributeMap +Public Interface ISelectionCriteria + Property AttrMap() As AttributeMap Property ValueA() As Object Property ValueB() As Object Property TableAlias() As String - Property ClassMap() As CClassMap + Property ClassMap() As ClassMap Property AddUsingOr() As Boolean - Sub fillSqlStatement(ByVal pStatement As CSqlStatement) + Sub FillSqlStatement(ByVal statement As AtomsSqlStatement) End Interface '''----------------------------------------------------------------------------- -''' Project : AToMSFramework -''' Class : CSelectionCriteria +''' Project : Atoms.Framework +''' Class : SelectionCriteria ''' '''----------------------------------------------------------------------------- ''' <summary> @@ -33,18 +33,18 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- -Public MustInherit Class CSelectionCriteria - Implements _CSelectionCriteria +Public MustInherit Class SelectionCriteria + Implements ISelectionCriteria '************************************************** - 'Class: CSelectionCriteria + 'Class: SelectionCriteria 'Author: Juan Carlos Alvarez '************************************************** - Private m_attrMap As CAttributeMap + Private m_attrMap As AttributeMap Private m_valueA As Object Private m_valueB As Object - Private m_classmap As CClassMap + Private m_classmap As ClassMap Private m_tableAlias As String Private m_addUsingOr As Boolean @@ -58,11 +58,11 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Property AttrMap() As CAttributeMap Implements _CSelectionCriteria.AttrMap + Public Property AttrMap() As AttributeMap Implements ISelectionCriteria.AttrMap Get AttrMap = m_attrMap End Get - Set(ByVal Value As CAttributeMap) + Set(ByVal Value As AttributeMap) m_attrMap = Value End Set End Property @@ -71,14 +71,14 @@ ''' <summary> ''' Method stub for generating the specific SQL and adding it to an SQL statement. ''' </summary> - ''' <param name="pStatement">The SQL statement to be modified</param> + ''' <param name="statement">The SQL statement to be modified</param> ''' <remarks>This must be implemented by each subclass to generate the SQL code ''' specific to the subclasses requirements.</remarks> ''' <history> ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public MustOverride Sub fillSqlStatement(ByVal pStatement As CSqlStatement) Implements _CSelectionCriteria.fillSqlStatement + Public MustOverride Sub FillSqlStatement(ByVal statement As AtomsSqlStatement) Implements ISelectionCriteria.fillSqlStatement '''----------------------------------------------------------------------------- ''' <summary> @@ -90,7 +90,7 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Property ValueA() As Object Implements _CSelectionCriteria.ValueA + Public Property ValueA() As Object Implements ISelectionCriteria.ValueA Get Return m_valueA End Get @@ -110,7 +110,7 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Property ValueB() As Object Implements _CSelectionCriteria.ValueB + Public Property ValueB() As Object Implements ISelectionCriteria.ValueB Get Return m_valueB End Get @@ -129,7 +129,7 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Property TableAlias() As String Implements _CSelectionCriteria.TableAlias + Public Property TableAlias() As String Implements ISelectionCriteria.TableAlias Get Return m_tableAlias End Get @@ -148,7 +148,7 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Property AddUsingOr() As Boolean Implements _CSelectionCriteria.AddUsingOr + Public Property AddUsingOr() As Boolean Implements ISelectionCriteria.AddUsingOr Get Return m_addUsingOr End Get @@ -167,16 +167,16 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Property ClassMap() As CClassMap Implements _CSelectionCriteria.ClassMap + Public Property ClassMap() As ClassMap Implements ISelectionCriteria.ClassMap Get Return m_classmap End Get - Set(ByVal Value As CClassMap) + Set(ByVal Value As ClassMap) m_classmap = Value End Set End Property - Public Sub New() + Protected Sub New() m_tableAlias = "" End Sub End Class \ No newline at end of file Index: IniFiles.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/IniFiles.vb,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- IniFiles.vb 21 Jul 2004 02:55:38 -0000 1.5 +++ IniFiles.vb 11 Apr 2005 00:31:44 -0000 1.6 @@ -2,7 +2,7 @@ Option Explicit On '''----------------------------------------------------------------------------- -''' Project : AToMSFramework +''' Project : Atoms.Framework ''' Class : IniFiles ''' '''----------------------------------------------------------------------------- Index: CInjectedObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CInjectedObject.vb,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- CInjectedObject.vb 7 Apr 2005 07:08:16 -0000 1.25 +++ CInjectedObject.vb 11 Apr 2005 00:31:43 -0000 1.26 @@ -5,19 +5,19 @@ 'These will be objects that do not inherit from the cperistentobject class, but which 'still need to be saved/retrieved from the database. -Public Class CInjectedObject +Public Class InjectedObject Implements IPersistableObject - Private m_object As Object + Private m_object As Object 'WeakReference Private m_originalObject As Object Private m_associationsLoaded As Boolean - Private m_oid As COID + Private m_oid As ObjectId Private m_cacheExpiry As Double Private m_guid As Guid - Private m_classmap As CClassMap + Private m_classmap As ClassMap Private m_persistent As Boolean Private m_state As PersistenceState = PersistenceState.Unknown - Private m_retrievedCacheKey As CCacheKey + Private m_retrievedCacheKey As CacheKey Private m_loading As Boolean Private m_queued As Boolean Private m_proxy As Boolean @@ -37,7 +37,11 @@ Public Property ReferencedObject() As Object Get - Return m_object + 'If m_object.IsAlive Then + Return m_object '.Target + 'Else + ' Return Nothing + 'End If End Get Set(ByVal Value As Object) m_object = Value @@ -59,32 +63,31 @@ Sub ReplaceWith(ByVal obj As IPersistableObject, ByVal copyEventHandlers As Boolean) Implements IPersistableObject.ReplaceWith If Not obj.GetObjectType Is Me.GetObjectType Then - Throw New Exception("Objects must be of the same type") + Throw New AtomsFrameworkException("Objects must be of the same type") End If - Dim injObj As CInjectedObject + Dim injObj As InjectedObject If Not obj.IsIPersistentObject Then - injObj = CType(obj, CInjectedObject) + injObj = CType(obj, InjectedObject) ReplaceValues(injObj.m_object, m_object, copyEventHandlers) Else ReplaceValues(obj, m_object, copyEventHandlers) End If End Sub - Public Sub ReplaceValues(ByVal sourceObject As Object, ByVal targetObject As Object, ByVal copyEventHandlers As Boolean) + Public Shared Sub ReplaceValues(ByVal source As Object, ByVal target As Object, ByVal copyEventHandlers As Boolean) 'Use reflection to copy all of the fields from sourceObj to targetobject (by value) - If sourceObject Is Nothing OrElse targetObject Is Nothing Then Return - If Not sourceObject.GetType Is targetObject.GetType And Not sourceObject.GetType.IsSubclassOf(targetObject.GetType) Then - Throw New Exception("Objects must be of the same type") + If source Is Nothing OrElse target Is Nothing Then Return + If Not source.GetType Is target.GetType And Not source.GetType.IsSubclassOf(target.GetType) Then + Throw New AtomsFrameworkException("Objects must be of the same type") End If - If sourceObject Is targetObject Then + If source Is target Then 'Same object so nothing to do Exit Sub End If Dim f, fields() As FieldInfo Dim value As Object - Dim t, iListType, iDicType As Type - Try - t = targetObject.GetType + Dim t, iListType, iDicType As Type Try + t = target.GetType While Not t Is Nothing fields = t.GetFields(BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) For Each f In fields @@ -92,13 +95,13 @@ 'This is an event! 'Do Nothing Else - iListType = f.FieldType.GetInterface("IList", True) - iDicType = f.FieldType.GetInterface("IDictionary", True) - 'Do not copy collections yet - we'll do that at the end - If iListType Is Nothing AndAlso iDicType Is Nothing Then - value = f.GetValue(sourceObject) - f.SetValue(targetObject, value) - End If + iListType = f.FieldType.GetInterface("IList", True) + iDicType = f.FieldType.GetInterface("IDictionary", True) + 'Do not copy collections yet - we'll do that at the end + If iListType Is Nothing AndAlso iDicType Is Nothing Then + value = f.GetValue(source) + f.SetValue(target, value) + End If End If Next If Not t.BaseType Is Nothing Then @@ -107,18 +110,17 @@ t = Nothing End If End While - CPersistenceBroker.CopyCollections(sourceObject, targetObject) - Catch ex As Exception + PersistenceBroker.CopyCollections(source, target) Catch ex As Exception Debug.WriteLine(ex.Message) End Try End Sub - Public Function getClassMap() As CClassMap Implements IPersistableObject.getClassMap - Dim tmpCMap As CClassMap + Public Function GetClassMap() As ClassMap Implements IPersistableObject.getClassMap + 'Dim tmpCMap As ClassMap If m_classmap Is Nothing Then - Dim persistenceBroker As CPersistenceBroker - persistenceBroker = getPersistenceBrokerInstance() - m_classmap = persistenceBroker.getClassMap(m_object.GetType) + Dim persistenceBroker As PersistenceBroker + persistenceBroker = GetPersistenceBrokerInstance() + m_classmap = persistenceBroker.GetClassMap(m_object.GetType) End If If (m_classmap Is Nothing) Then Throw New NoClassMapException("No class map for " & m_object.GetType.FullName) @@ -126,13 +128,13 @@ Return m_classmap End Function - Private Function getClassMap(ByVal name As String, ByVal fullname As String) As CClassMap + Private Function GetClassMap(ByVal name As String, ByVal fullname As String) As ClassMap If m_classmap Is Nothing Then - Dim persistenceBroker As CPersistenceBroker - persistenceBroker = getPersistenceBrokerInstance() - m_classmap = persistenceBroker.getClassMap(name) + Dim persistenceBroker As PersistenceBroker + persistenceBroker = GetPersistenceBrokerInstance() + m_classmap = persistenceBroker.GetClassMap(name) If m_classmap Is Nothing Then - m_classmap = persistenceBroker.getClassMap(fullname) + m_classmap = persistenceBroker.GetClassMap(fullname) End If If (m_classmap Is Nothing) Then Return Nothing @@ -142,23 +144,23 @@ End Function Public Function GetObjectType() As Type Implements IPersistableObject.GetObjectType - If m_object Is Nothing Then + If m_object Is Nothing Then 'OrElse Not m_object.IsAlive Then Return GetType(Object) End If Return m_object.GetType End Function - Public Function getValueByAttribute(ByVal obj As Object, ByVal pName As String) As Object + Public Shared Function GetValueByAttribute(ByVal obj As Object, ByVal name As String) As Object Dim dotPos As Integer - dotPos = pName.IndexOf(".") + dotPos = name.IndexOf(".") If dotPos = -1 Then - Return CallByName(obj, pName, CallType.Get) + Return CallByName(obj, name, CallType.Get) Else Dim o As Object Dim objName As String Dim propertyName As String - objName = pName.Substring(0, dotPos) - propertyName = pName.Substring(dotPos + 1) + objName = name.Substring(0, dotPos) + propertyName = name.Substring(dotPos + 1) o = CallByName(obj, objName, CallType.Get) If o Is Nothing Then Return Nothing @@ -167,18 +169,18 @@ End If End Function - Public Function getValueByAttribute(ByVal pName As String) As Object Implements IPersistableObject.getValueByAttribute - Return getValueByAttribute(m_object, pName) + Public Function GetValueByAttribute(ByVal name As String) As Object Implements IPersistableObject.getValueByAttribute + Return GetValueByAttribute(m_object, name) End Function - Public Function getOriginalValueByAttribute(ByVal pName As String) As Object - Return getValueByAttribute(m_originalObject, pName) + Public Function GetOriginalValueByAttribute(ByVal name As String) As Object + Return GetValueByAttribute(m_originalObject, name) End Function Public Property AssociationsLoaded() As Boolean Implements IPersistableObject.AssociationsLoaded Get - If Me.getClassMap.AssociationMapCount > 0 Then - Return m_associationsLoaded + If Me.GetClassMap.AssociationMapCount > 0 Then + Return m_associationsLoaded Else 'If the class has no associations then associations are already "loaded" 'However if the object is not persistent then the associations obviously can't be loaded yet @@ -217,46 +219,46 @@ End Set End Property - Public Function getFieldLengthByName(ByVal x As String) As Integer Implements IPersistableObject.getFieldLengthByName - Return getClassMap.getAttributeMapByString(x, True).ColumnMap.StorageSize() + Public Function GetFieldLengthByName(ByVal propertyName As String) As Integer Implements IPersistableObject.getFieldLengthByName + Return GetClassMap.GetAttributeMapByString(propertyName, True).ColumnMap.StorageSize() End Function - Public Function getFieldTypeByName(ByVal x As String) As System.Type Implements IPersistableObject.getFieldTypeByName - Return getClassMap.getAttributeMapByString(x, True).ColumnMap.StorageType + Public Function GetFieldTypeByName(ByVal propertyName As String) As System.Type Implements IPersistableObject.getFieldTypeByName + Return GetClassMap.GetAttributeMapByString(propertyName, True).ColumnMap.StorageType End Function - Public Property GUIDValue() As String Implements IPersistableObject.GUIDValue + Public Property GuidValue() As String Implements IPersistableObject.GUIDValue Get If m_guid.Equals(Guid.Empty) Then m_guid = Guid.NewGuid End If - GUIDValue = m_guid.ToString("N") + Return m_guid.ToString("N") End Get - Set(ByVal value As String) - m_guid = New Guid(value) + Set(ByVal Value As String) + m_guid = New Guid(Value) End Set End Property - Public Function ObjectsMatch(ByVal sourceObject As Object, ByVal targetObject As Object) As Boolean - If sourceObject Is Nothing AndAlso targetObject Is Nothing Then Return True - If sourceObject Is Nothing OrElse targetObject Is Nothing Then Return False - If Not sourceObject.GetType Is targetObject.GetType Then + Public Function ObjectsMatch(ByVal source As Object, ByVal target As Object) As Boolean + If source Is Nothing AndAlso target Is Nothing Then Return True + If source Is Nothing OrElse target Is Nothing Then Return False + If Not source.GetType Is target.GetType Then Return False End If - Dim cmap As CClassMap + Dim cmap As ClassMap Dim value As Object, value1 As Object - cmap = Me.getClassMap() + cmap = Me.GetClassMap() 'Do equality checks only on attributes that will be persisted 'Everything else is ignorable since it's only the database mapped fields 'that are important While Not cmap Is Nothing - For Each att As CAttributeMap In cmap.AttributeMaps + For Each att As AttributeMap In cmap.AttributeMaps If Not att.ColumnMap Is Nothing Then - value = getValueByAttribute(sourceObject, att.Name) - value1 = getValueByAttribute(targetObject, att.Name) + value = GetValueByAttribute(source, att.Name) + value1 = GetValueByAttribute(target, att.Name) If Not Equals(value, value1) Then Return False End If @@ -308,9 +310,9 @@ End Set End Property - Public ReadOnly Property isModifyOnly() As Boolean Implements IPersistableObject.isModifyOnly + Public ReadOnly Property IsModifyOnly() As Boolean Implements IPersistableObject.isModifyOnly Get - Return getClassMap.isModifyOnly + Return GetClassMap.IsModifyOnly End Get End Property @@ -323,26 +325,26 @@ End Set End Property - Public ReadOnly Property isReadOnly() As Boolean Implements IPersistableObject.isReadOnly + Public ReadOnly Property IsReadOnly() As Boolean Implements IPersistableObject.isReadOnly Get - Return getClassMap.isReadOnly + Return GetClassMap.IsReadOnly End Get End Property - Public Property OIDValue() As String Implements IPersistableObject.OIDValue + Public Property OidValue() As String Implements IPersistableObject.OIDValue Get - Dim oidfactory As COIDFactory + Dim oidfactory As ObjectIdFactory If m_oid Is Nothing Then - oidfactory = getOIDFactoryInstance() - m_oid = oidfactory.newOID + oidfactory = GetOidFactoryInstance() + m_oid = oidfactory.NewOid End If - OIDValue = m_oid.OID + Return m_oid.OID End Get - Set(ByVal value As String) + Set(ByVal Value As String) If m_oid Is Nothing Then - m_oid = New COID + m_oid = New ObjectId End If - m_oid.OID = value + m_oid.OID = Value End Set End Property @@ -364,22 +366,22 @@ End Set End Property - Public Function getCollectionByAttribute(ByVal pName As String) As IList Implements IPersistableObject.getCollectionByAttribute - Return getCollectionByAttribute(m_object, pName) + Public Function GetCollectionByAttribute(ByVal name As String) As IList Implements IPersistableObject.getCollectionByAttribute + Return GetCollectionByAttribute(m_object, name) End Function - Private Function getCollectionByAttribute(ByVal srcObj As Object, ByVal pName As String) As IList + Private Shared Function GetCollectionByAttribute(ByVal srcObj As Object, ByVal name As String) As IList Dim dotPos As Integer - dotPos = pName.IndexOf(".") + dotPos = name.IndexOf(".") Try If dotPos = -1 Then - Return CType(CallByName(srcObj, pName, CallType.Get), IList) + Return CType(CallByName(srcObj, name, CallType.Get), IList) Else Dim o As Object Dim objName As String Dim propertyName As String - objName = pName.Substring(0, dotPos) - propertyName = pName.Substring(dotPos + 1) + objName = name.Substring(0, dotPos) + propertyName = name.Substring(dotPos + 1) o = CallByName(srcObj, objName, CallType.Get) If o Is Nothing Then Return Nothing @@ -387,30 +389,30 @@ Return CType(CallByName(o, propertyName, CallType.Get), IList) End If Catch err As Exception - Throw New Exception("getCollectionByAttribute failed for attribute " & pName & " in " & srcObj.GetType.FullName, err) + Throw New AtomsFrameworkException("getCollectionByAttribute failed for attribute " & name & " in " & srcObj.GetType.FullName, err) End Try End Function - Public Function getObjectByAttribute(ByVal pName As String) As IPersistableObject Implements IPersistableObject.getObjectByAttribute - Return getObjectByAttribute(m_object, pName) + Public Function GetObjectByAttribute(ByVal name As String) As IPersistableObject Implements IPersistableObject.getObjectByAttribute + Return GetObjectByAttribute(m_object, name) End Function - Private Function getObjectByAttribute(ByVal srcObj As Object, ByVal pName As String) As IPersistableObject + Private Shared Function GetObjectByAttribute(ByVal srcObj As Object, ByVal name As String) As IPersistableObject Dim dotPos As Integer Dim obj As Object Dim injobj As IPersistableObject - Dim pbroker As CPersistenceBroker + Dim broker As PersistenceBroker - dotPos = pName.IndexOf(".") + dotPos = name.IndexOf(".") Try If dotPos = -1 Then - obj = CallByName(srcObj, pName, CallType.Get) + obj = CallByName(srcObj, name, CallType.Get) Else Dim o As Object Dim objName As String Dim propertyName As String - objName = pName.Substring(0, dotPos) - propertyName = pName.Substring(dotPos + 1) + objName = name.Substring(0, dotPos) + propertyName = name.Substring(dotPos + 1) o = CallByName(srcObj, objName, CallType.Get) If o Is Nothing Then Return Nothing @@ -422,110 +424,110 @@ If TypeOf obj Is IPersistableObject Then injobj = obj Else - pbroker = getPersistenceBrokerInstance() - injobj = pbroker.getInjectedObject(obj) + broker = GetPersistenceBrokerInstance() + injobj = broker.GetInjectedObject(obj) End If Catch ex As Exception - Throw New Exception("getObjectByAttribute failed for attribute " & pName & " in " & srcObj.GetType.FullName, ex) + Throw New AtomsFrameworkException("getObjectByAttribute failed for attribute " & name & " in " & srcObj.GetType.FullName, ex) End Try Return injobj End Function - Public Sub setAttributeValue(ByVal pName As String, ByRef Value As Object) Implements IPersistableObject.setAttributeValue - setAttributeValue(m_object, pName, Value) + Public Sub SetAttributeValue(ByVal name As String, ByRef value As Object) Implements IPersistableObject.setAttributeValue + SetAttributeValue(m_object, name, value) End Sub - Public Sub setAttributeValue(ByVal obj As Object, ByVal pName As String, ByRef Value As Object) - If TypeOf (Value) Is System.DBNull Then + Public Shared Sub SetAttributeValue(ByVal obj As Object, ByVal name As String, ByRef value As Object) + If TypeOf (value) Is System.DBNull Then Exit Sub End If Dim dotPos As Integer - dotPos = pName.IndexOf(".") + dotPos = name.IndexOf(".") Try If dotPos = -1 Then - If TypeOf (Value) Is System.SByte Then - CallByName(obj, pName, CallType.Set, IIf(Value.ToString = "1", True, False)) + If TypeOf (value) Is System.SByte Then + CallByName(obj, name, CallType.Set, IIf(value.ToString = "1", True, False)) Else - CallByName(obj, pName, CallType.Set, Value) + CallByName(obj, name, CallType.Set, value) End If Else Dim o As Object Dim objName As String Dim propertyName As String Dim val As ValueType - objName = pName.Substring(0, dotPos) - propertyName = pName.Substring(dotPos + 1) + objName = name.Substring(0, dotPos) + propertyName = name.Substring(dotPos + 1) o = CallByName(obj, objName, CallType.Get) If o Is Nothing Then Return End If If o.GetType.IsValueType Then val = o - If TypeOf (Value) Is System.SByte Then - CallByName(val, propertyName, CallType.Set, IIf(Value.ToString = "1", True, False)) + If TypeOf (value) Is System.SByte Then + CallByName(val, propertyName, CallType.Set, IIf(value.ToString = "1", True, False)) Else - CallByName(val, propertyName, CallType.Set, Value) + CallByName(val, propertyName, CallType.Set, value) End If CallByName(obj, objName, CallType.Set, val) Else - If TypeOf (Value) Is System.SByte Then - CallByName(o, propertyName, CallType.Set, IIf(Value.ToString = "1", True, False)) + If TypeOf (value) Is System.SByte Then + CallByName(o, propertyName, CallType.Set, IIf(value.ToString = "1", True, False)) Else - CallByName(o, propertyName, CallType.Set, Value) + CallByName(o, propertyName, CallType.Set, value) End If End If End If Catch ex As Exception - Throw New AttributeValueException("Could not set attribute " & pName & " (Value Type: " _ - & Value.GetType.Name & ") in CPersistentObject::SetAttributeValue." & vbCrLf & ex.Message, ex) + Throw New AttributeValueException("Could not set attribute " & name & " (Value Type: " _ + & value.GetType.Name & ") in PersistentObject::SetAttributeValue." & vbCrLf & ex.Message, ex) End Try End Sub - Friend Property OriginalCacheKey() As CCacheKey Implements IPersistableObject.OriginalCacheKey + Friend Property OriginalCacheKey() As CacheKey Implements IPersistableObject.OriginalCacheKey Get Return m_retrievedCacheKey End Get - Set(ByVal Value As CCacheKey) + Set(ByVal Value As CacheKey) m_retrievedCacheKey = Value End Set End Property Public Overloads Function Equals(ByVal obj As IPersistableObject) As Boolean Implements IPersistableObject.Equals - Dim ck1, ck2 As CCacheKey + Dim ck1, ck2 As CacheKey If Me Is Nothing And Not obj Is Nothing Then Return False End If If obj Is Nothing And Not Me Is Nothing Then Return False End If - ck1 = New CCacheKey(Me) - ck2 = New CCacheKey(obj) + ck1 = New CacheKey(Me) + ck2 = New CacheKey(obj) Return ck1.Equals(ck2) And Me.Persistent = obj.Persistent End Function Public Function Copy() As IPersistableObject Implements IPersistableObject.Copy - Dim injobj As CInjectedObject - injobj = Me.getClassMap.CreateObjectInstance + Dim injobj As InjectedObject + injobj = Me.GetClassMap.CreateObjectInstance Me.ReplaceValues(Me.GetSourceObject, injobj.GetSourceObject, False) 'For now we will copy the full object including event handlers 'Me.ReplaceValues(Me.GetSourceObject, injobj.GetSourceObject, True) - 'injobj = CType(Me.MemberwiseClone, CInjectedObject) + 'injobj = CType(Me.MemberwiseClone, InjectedObject) 'Because memberwise clone only reference copies collections we should also 'copy the collections as well, since failing to do so can corrupt the cache. - 'CPersistenceBroker.CopyCollections(Me.GetSourceObject, injobj.GetSourceObject) + 'PersistenceBroker.CopyCollections(Me.GetSourceObject, injobj.GetSourceObject) Return injobj End Function - Function getObjectByClassMap(ByVal classMap As CClassMap) As IPersistableObject Implements IPersistableObject.getObjectByClassMap - Dim obj, Value As IPersistableObject - Dim col As IList - Dim i, k As Short - Dim cm As CClassMap - Dim de As DictionaryEntry - Dim udamap As CUDAMap + Function GetObjectByClassMap(ByVal classMap As ClassMap) As IPersistableObject Implements IPersistableObject.getObjectByClassMap + Dim obj As IPersistableObject + 'Dim col As IList + Dim i As Short ', k As Short + Dim cm As ClassMap + 'Dim de As DictionaryEntry + Dim udamap As AssociationMap obj = classMap.CreateObjectInstance @@ -535,28 +537,28 @@ obj.State = Me.State End If - Dim ci As CInjectedObject + Dim ci As InjectedObject If Not obj.IsIPersistentObject Then - ci = CType(obj, CInjectedObject) + ci = CType(obj, InjectedObject) End If 'set object's attributes - also copy the original values as well. 'set the associated objects - For i = 1 To classMap.getStraightAssociationMapSize - udamap = classMap.getStraightAssociationMap(i) - If udamap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_ONE Then - obj.SetAttributeValue(udamap.FromClassTarget, Me.getObjectByAttribute(udamap.FromClassTarget)) - If Not ci Is Nothing Then ci.setAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.getObjectByAttribute(m_originalObject, udamap.FromClassTarget)) - ElseIf udamap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_MANY Or udamap.Cardinality = CUDAMap.CardinalityEnum.MANY_TO_MANY Then - obj.SetAttributeValue(udamap.FromClassTarget, Me.getCollectionByAttribute(udamap.FromClassTarget)) - If Not ci Is Nothing Then ci.setAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.getCollectionByAttribute(m_originalObject, udamap.FromClassTarget)) + For i = 1 To classMap.GetStraightAssociationMapSize + udamap = classMap.GetStraightAssociationMap(i) + If udamap.CardinalityType = AssociationMap.Cardinality.OneToOne Then + obj.SetAttributeValue(udamap.FromClassTarget, Me.GetObjectByAttribute(udamap.FromClassTarget)) + If Not ci Is Nothing Then ci.SetAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.GetObjectByAttribute(m_originalObject, udamap.FromClassTarget)) + ElseIf udamap.CardinalityType = AssociationMap.Cardinality.OneToMany Or udamap.CardinalityType = AssociationMap.Cardinality.ManyToMany Then + obj.SetAttributeValue(udamap.FromClassTarget, Me.GetCollectionByAttribute(udamap.FromClassTarget)) + If Not ci Is Nothing Then ci.SetAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.GetCollectionByAttribute(m_originalObject, udamap.FromClassTarget)) End If Next i - Dim AttrMap As CAttributeMap + Dim AttrMap As AttributeMap For i = 1 To CType(classMap.AttributeMaps.Count, Short) - AttrMap = classMap.getAttributeMap(i) + AttrMap = classMap.GetAttributeMap(i) If Not AttrMap.ColumnMap Is Nothing Then - obj.SetAttributeValue(AttrMap.Name, Me.getValueByAttribute(AttrMap.Name)) - If Not ci Is Nothing Then ci.setAttributeValue(ci.m_originalObject, AttrMap.Name, Me.getOriginalValueByAttribute(AttrMap.Name)) + obj.SetAttributeValue(AttrMap.Name, Me.GetValueByAttribute(AttrMap.Name)) + If Not ci Is Nothing Then ci.SetAttributeValue(ci.m_originalObject, AttrMap.Name, Me.GetOriginalValueByAttribute(AttrMap.Name)) End If Next @@ -564,23 +566,23 @@ cm = classMap.SuperClass While Not cm Is Nothing 'set the associated objects - For i = 1 To cm.getStraightAssociationMapSize - udamap = cm.getStraightAssociationMap(i) - If udamap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_ONE Then - obj.SetAttributeValue(udamap.FromClassTarget, Me.getObjectByAttribute(udamap.FromClassTarget)) - If Not ci Is Nothing Then ci.setAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.getObjectByAttribute(m_originalObject, udamap.FromClassTarget)) - ElseIf udamap.Cardinality = CUDAMap.CardinalityEnum.ONE_TO_MANY Or udamap.Cardinality = CUDAMap.CardinalityEnum.MANY_TO_MANY Then - obj.SetAttributeValue(udamap.FromClassTarget, Me.getCollectionByAttribute(udamap.FromClassTarget)) - If Not ci Is Nothing Then ci.setAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.getCollectionByAttribute(m_originalObject, udamap.FromClassTarget)) + For i = 1 To cm.GetStraightAssociationMapSize + udamap = cm.GetStraightAssociationMap(i) + If udamap.CardinalityType = AssociationMap.Cardinality.OneToOne Then + obj.SetAttributeValue(udamap.FromClassTarget, Me.GetObjectByAttribute(udamap.FromClassTarget)) + If Not ci Is Nothing Then ci.SetAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.GetObjectByAttribute(m_originalObject, udamap.FromClassTarget)) + ElseIf udamap.CardinalityType = AssociationMap.Cardinality.OneToMany Or udamap.CardinalityType = AssociationMap.Cardinality.ManyToMany Then + obj.SetAttributeValue(udamap.FromClassTarget, Me.GetCollectionByAttribute(udamap.FromClassTarget)) + If Not ci Is Nothing Then ci.SetAttributeValue(ci.m_originalObject, udamap.FromClassTarget, Me.GetCollectionByAttribute(m_originalObject, udamap.FromClassTarget)) End If Next i 'set superclass's attributes For i = 1 To CType(cm.AttributeMaps.Count, Short) - AttrMap = cm.getAttributeMap(i) + AttrMap = cm.GetAttributeMap(i) If Not AttrMap.ColumnMap Is Nothing Then - obj.SetAttributeValue(AttrMap.Name, Me.getValueByAttribute(AttrMap.Name)) - If Not ci Is Nothing Then ci.setAttributeValue(ci.m_originalObject, AttrMap.Name, Me.getValueByAttribute(m_originalObject, AttrMap.Name)) + obj.SetAttributeValue(AttrMap.Name, Me.GetValueByAttribute(AttrMap.Name)) + If Not ci Is Nothing Then ci.SetAttributeValue(ci.m_originalObject, AttrMap.Name, Me.GetValueByAttribute(m_originalObject, AttrMap.Name)) End If Next cm = cm.SuperClass @@ -591,11 +593,11 @@ Public Overrides Function ToString() As String Dim s As String Dim i As Short - Dim indent As Integer + 'Dim indent As Integer Dim formatString As String - Dim cm As CClassMap - Dim am As CAttributeMap + Dim cm As ClassMap + Dim am As AttributeMap Dim x As Object Dim y As Object Dim xstring As String @@ -606,19 +608,19 @@ End If s = Me.GetObjectType.ToString & ": " & vbCrLf - indent = s.Length + 'indent = s.Length formatString = Space(s.Length) & "{0,-9}" & vbTab & "{1,-13}" & vbTab & "{2,-14}" & vbCrLf s &= [String].Format(formatString, "Attribute", "Current Value", "Original Value") s &= [String].Format(formatString, "---------", "-------------", "--------------") i = 0 - cm = getClassMap() - For i = 1 To cm.getKeySize - am = cm.getKeyAttributeMap(i) - x = Me.getValueByAttribute(am.Name) - y = Me.getOriginalValueByAttribute(am.Name) + cm = GetClassMap() + For i = 1 To cm.GetKeySize + am = cm.GetKeyAttributeMap(i) + x = Me.GetValueByAttribute(am.Name) + y = Me.GetOriginalValueByAttribute(am.Name) Try xstring = x.ToString - Catch ex As Exception + Catch If x Is Nothing Then xstring = "Nothing" Else @@ -627,7 +629,7 @@ End Try Try ystring = y.ToString - Catch ex As Exception + Catch If y Is Nothing Then ystring = "Nothing" Else @@ -643,13 +645,13 @@ Return m_object End Function - Public Overridable Function hasValidKey() As Boolean Implements IPersistableObject.HasValidKey + Public Overridable Function HasValidKey() As Boolean Implements IPersistableObject.HasValidKey 'Check for any non-null key attributes - Dim am As CAttributeMap - Dim cm As CClassMap - cm = Me.getClassMap + Dim am As AttributeMap + Dim cm As ClassMap + cm = Me.GetClassMap For Each am In cm.KeyAttributeMaps - If Not IsNullAlias(Me.getValueByAttribute(am.Name)) Then + If Not IsNullAlias(Me.GetValueByAttribute(am.Name)) Then Return True End If Next @@ -657,30 +659,30 @@ End Function Private Sub CopyOneToManyCollections() Implements IPersistableObject.CopyOneToManyCollections - Dim cm As CClassMap + Dim cm As ClassMap Dim coll As Object - cm = Me.getClassMap + cm = Me.GetClassMap m_oneToManyCollections = New Collection - Dim aMap As CUDAMap + Dim aMap As AssociationMap While Not cm Is Nothing - For Each de As DictionaryEntry In cm.AssociationMaps - aMap = de.Value - If aMap.Cardinality = aMap.CardinalityEnum.ONE_TO_MANY Then - coll = CPersistenceBroker.CopyCollection(Me, aMap.FromClassTarget) - m_oneToManyCollections.Add(coll, aMap.FromClassTarget) - End If - Next + For Each de As DictionaryEntry In cm.AssociationMaps + aMap = de.Value + If aMap.CardinalityType = aMap.Cardinality.OneToMany Then + coll = PersistenceBroker.CopyCollection(Me, aMap.FromClassTarget) + m_oneToManyCollections.Add(coll, aMap.FromClassTarget) + End If + Next cm = cm.SuperClass End While End Sub Public Function GetRemovedCollectionItems(ByVal propertyName As String) As Collection Implements IPersistableObject.GetRemovedCollectionItems - Dim t, iListType, iDicType As Type - Dim fromColl, origColl, collItem As Object + Dim iListType, iDicType As Type + Dim origColl, collItem As Object Dim fromIList, origIList As IList - Dim fromDict, origDict As IDictionary + Dim fromDict As IDictionary Dim p As PropertyInfo - Dim tmpObj As Object + 'Dim tmpObj As Object Dim toColl As New Collection Dim injObj As IPersistableObject @@ -688,24 +690,24 @@ If m_oneToManyCollections.Count = 0 Then origColl = Nothing Else - origColl = m_oneToManyCollections.Item(PropertyName) + origColl = m_oneToManyCollections.Item(propertyName) End If Catch origColl = Nothing End Try If origColl Is Nothing Then Return toColl - p = Me.GetObjectType.GetProperty(PropertyName, BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) + p = Me.GetObjectType.GetProperty(propertyName, BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) iListType = p.PropertyType.GetInterface("IList", True) iDicType = p.PropertyType.GetInterface("IDictionary", True) If Not iListType Is Nothing OrElse Not iDicType Is Nothing Then If Not iListType Is Nothing Then origIList = CType(origColl, IList) - fromIList = CType(Me.getValueByAttribute(PropertyName), IList) + fromILis... [truncated message content] |