You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(56) |
Nov
(13) |
Dec
(36) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(7) |
Feb
(55) |
Mar
(33) |
Apr
(71) |
May
(12) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Richard B. <rb...@us...> - 2004-10-13 01:36:47
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29501 Modified Files: AToMSFramework.vbproj CPersistentObject.vb Added Files: IPersistentObject.vb Log Message: Added interface to CPersistentObject (called IPersistentObject) to allow other interfaces to inherit the persistence functions. Index: AToMSFramework.vbproj =================================================================== RCS file: /cvsroot/jcframework/dotnet/AToMSFramework.vbproj,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- AToMSFramework.vbproj 27 Sep 2004 02:39:31 -0000 1.16 +++ AToMSFramework.vbproj 13 Oct 2004 01:36:34 -0000 1.17 @@ -359,6 +359,11 @@ BuildAction = "Compile" /> <File + RelPath = "IPersistentObject.vb" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "modAliasNull.vb" SubType = "Code" BuildAction = "Compile" --- NEW FILE: IPersistentObject.vb --- Public Interface IPersistentObject Property Persistent() As Boolean Property IsProxy() As Boolean Property IsDirty() As Boolean Property ExpiryInterval() As Double Property OIDValue() As String Property GUIDValue() As String Property CreatedDate() As Date Property ModifiedDate() As Date Property AssociationsLoaded() As Boolean Property IsLoading() As Boolean ReadOnly Property isReadOnly() As Boolean ReadOnly Property isModifyOnly() As Boolean 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 Find() As Boolean Function Find(ByRef obj As CPersistentObject) As Boolean Function Find(ByRef obj As CPersistentObject, 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 Delete() Sub Delete(ByVal deleteSuperClass As Boolean) Sub Delete(ByVal obj As CPersistentObject) Sub Delete(ByVal obj As CPersistentObject, ByVal deleteSuperClass As Boolean) Sub DeleteAll() Function Copy() As CPersistentObject Function IsValid() As Boolean Function IsReferenced() As Boolean Function getNewObject() As CPersistentObject Function getClassMap() As CClassMap Function getFieldLengthByName(ByVal x As String) As Integer Function getFieldTypeByName(ByVal x As String) As Type Event MarkedAsDirty As EventHandler Event LoadStarted As EventHandler Event LoadFinished As EventHandler End Interface Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- CPersistentObject.vb 11 Oct 2004 22:50:56 -0000 1.39 +++ CPersistentObject.vb 13 Oct 2004 01:36:35 -0000 1.40 @@ -26,6 +26,7 @@ Implements IComponent Implements IEditableObject Implements IDataErrorInfo + Implements IPersistentObject Private m_persistent As Boolean Private m_proxy As Boolean @@ -44,9 +45,9 @@ Private m_editing As Boolean <NonSerialized()> Private m_classmap As CClassMap - Public Event MarkedAsDirty As EventHandler - Public Event LoadStarted As EventHandler - Public Event LoadFinished As EventHandler + Public Event MarkedAsDirty As EventHandler Implements IPersistentObject.MarkedAsDirty + Public Event LoadStarted As EventHandler Implements IPersistentObject.LoadStarted + Public Event LoadFinished As EventHandler Implements IPersistentObject.LoadFinished Friend Event RemoveMe(ByVal pObj As CPersistentObject) <NonSerialized()> Private m_preEditCopy As CPersistentObject @@ -67,291 +68,291 @@ ''' [rbanks] 25/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - <Browsable(False)> Public ReadOnly Property isReadOnly() As Boolean - Get - Return getClassMap(Me).isReadOnly - End Get - End Property + <Browsable(False)> Public ReadOnly Property isReadOnly() As Boolean Implements IPersistentObject.isReadOnly + Get + Return getClassMap(Me).isReadOnly + End Get + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Flag to indicate that objects cannot be created or deleted. - ''' </summary> - ''' <value>Boolean to indicate wether the object only permits modification.</value> - ''' <remarks>When this flag is on it indicates that the persistent object is only - ''' able to be modified. Any attempt to delete or save a newly created object will - ''' result in an exception being thrown. - ''' <para>This flag is different to the isReadOnly property in that it also allows - ''' an object to be changed.</para> - ''' <para>Typical uses include mapping an object to a view that also permits updates - ''' to occur, but for which creation and deletion of records is not permitted.</para></remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public ReadOnly Property isModifyOnly() As Boolean - Get - Return getClassMap(Me).isModifyOnly - End Get - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Flag to indicate that objects cannot be created or deleted. + ''' </summary> + ''' <value>Boolean to indicate wether the object only permits modification.</value> + ''' <remarks>When this flag is on it indicates that the persistent object is only + ''' able to be modified. Any attempt to delete or save a newly created object will + ''' result in an exception being thrown. + ''' <para>This flag is different to the isReadOnly property in that it also allows + ''' an object to be changed.</para> + ''' <para>Typical uses include mapping an object to a view that also permits updates + ''' to occur, but for which creation and deletion of records is not permitted.</para></remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public ReadOnly Property isModifyOnly() As Boolean Implements IPersistentObject.isModifyOnly + Get + Return getClassMap(Me).isModifyOnly + End Get + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Flag indicating wether the object is persistent or not - ''' </summary> - ''' <value>Boolean indicating if the object is persistent</value> - ''' <remarks>Objects that are retrieved from the persistent broker are either - ''' marked as persistent or not. If the object was successfully retrieved using values from the - ''' database then the object will be marked as persistent. If no relevant database records - ''' could be found the object is instantiated, but marked as non persistent. - ''' <para>An new object that is created is initially marked as non-persistent, however - ''' once the object is successfully saved to the database it will be marked as - ''' persistent</para> - ''' <para>Setting this value manually is not recommended and can result in unexpected behaviour</para> - ''' </remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property Persistent() As Boolean - Get - Persistent = m_persistent - End Get - Set(ByVal Value As Boolean) - m_persistent = Value - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Flag indicating wether the object is persistent or not + ''' </summary> + ''' <value>Boolean indicating if the object is persistent</value> + ''' <remarks>Objects that are retrieved from the persistent broker are either + ''' marked as persistent or not. If the object was successfully retrieved using values from the + ''' database then the object will be marked as persistent. If no relevant database records + ''' could be found the object is instantiated, but marked as non persistent. + ''' <para>An new object that is created is initially marked as non-persistent, however + ''' once the object is successfully saved to the database it will be marked as + ''' persistent</para> + ''' <para>Setting this value manually is not recommended and can result in unexpected behaviour</para> + ''' </remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property Persistent() As Boolean Implements IPersistentObject.Persistent + Get + Persistent = m_persistent + End Get + Set(ByVal Value As Boolean) + m_persistent = Value + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Indicates if the all atributes are populated or only those marked as proxy attributes - ''' </summary> - ''' <value>Boolean indicating only proxy attributes are populated</value> - ''' <remarks>When an object is retrieved via a CCursor the returned object can either - ''' be a proxy object or a full object. This behaviour is determined by the CCursor. - ''' <para>If the CCursor returns proxy objects, only information related to the proxy - ''' attributes will be returned and only a partially populated object can be - ''' instantiated. The proxy flag will be set to indicate to the application that the - ''' object is not complete, and also to prevent the framework from performing any - ''' persistence operations such as save and delete.</para> - ''' <para>Once a proxy object is fully retrieved the proxy flag will be turned off and - ''' normal object operations can be performed</para> - ''' </remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property IsProxy() As Boolean - Get - IsProxy = m_proxy - End Get - Set(ByVal Value As Boolean) - m_proxy = Value - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Indicates if the all atributes are populated or only those marked as proxy attributes + ''' </summary> + ''' <value>Boolean indicating only proxy attributes are populated</value> + ''' <remarks>When an object is retrieved via a CCursor the returned object can either + ''' be a proxy object or a full object. This behaviour is determined by the CCursor. + ''' <para>If the CCursor returns proxy objects, only information related to the proxy + ''' attributes will be returned and only a partially populated object can be + ''' instantiated. The proxy flag will be set to indicate to the application that the + ''' object is not complete, and also to prevent the framework from performing any + ''' persistence operations such as save and delete.</para> + ''' <para>Once a proxy object is fully retrieved the proxy flag will be turned off and + ''' normal object operations can be performed</para> + ''' </remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property IsProxy() As Boolean Implements IPersistentObject.IsProxy + Get + IsProxy = m_proxy + End Get + Set(ByVal Value As Boolean) + m_proxy = Value + End Set + End Property - ''' ----------------------------------------------------------------------------- - ''' <summary> - ''' Indicates wether the persistence broker is currently checking the objects associations - ''' </summary> - ''' <returns>Boolean indicating whether the check is currently in progress</returns> - ''' <remarks>When an object is retrieved it's associations must be checked to determine - ''' if they are instantiated or not. This flag indicates wether the check - ''' is in progress or not. - ''' </remarks> - ''' <history> - ''' [rbanks] 16/08/2004 Created - ''' </history> - ''' ----------------------------------------------------------------------------- - <Browsable(False)> Friend Property CheckingAssociations() As Boolean - Get - Return m_checkingAssociations - End Get - Set(ByVal Value As Boolean) - m_checkingAssociations = Value - End Set - End Property + ''' ----------------------------------------------------------------------------- + ''' <summary> + ''' Indicates wether the persistence broker is currently checking the objects associations + ''' </summary> + ''' <returns>Boolean indicating whether the check is currently in progress</returns> + ''' <remarks>When an object is retrieved it's associations must be checked to determine + ''' if they are instantiated or not. This flag indicates wether the check + ''' is in progress or not. + ''' </remarks> + ''' <history> + ''' [rbanks] 16/08/2004 Created + ''' </history> + ''' ----------------------------------------------------------------------------- + <Browsable(False)> Friend Property CheckingAssociations() As Boolean + Get + Return m_checkingAssociations + End Get + Set(ByVal Value As Boolean) + m_checkingAssociations = Value + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Flag indicating that the object has been modified - ''' </summary> - ''' <value>Boolean indicating that the object has been modified</value> - ''' <remarks>This flag must be set by the object whenever one of it's properties changes. - ''' Failing to do so will prevent the AtomsFramework from updating the database when - ''' the save method is performed. - ''' <para>When an object is initially received this flag will be False.</para> - ''' <para>Note: Changes to objects in a CPersistentCollection can result in this flag being set.</para></remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property IsDirty() As Boolean - Get - IsDirty = m_dirty - End Get - Set(ByVal Value As Boolean) - If Value = True Then - m_modifiedDate = Now 'Set modified date - 'Set milliseconds to zero to avoid issues with millisecond inconsistencies in SQL db's - m_modifiedDate = m_modifiedDate.AddMilliseconds(-m_modifiedDate.Millisecond) - If m_dirty = False Then - RaiseEvent MarkedAsDirty(Me, New EventArgs) - End If - End If - m_dirty = Value - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Flag indicating that the object has been modified + ''' </summary> + ''' <value>Boolean indicating that the object has been modified</value> + ''' <remarks>This flag must be set by the object whenever one of it's properties changes. + ''' Failing to do so will prevent the AtomsFramework from updating the database when + ''' the save method is performed. + ''' <para>When an object is initially received this flag will be False.</para> + ''' <para>Note: Changes to objects in a CPersistentCollection can result in this flag being set.</para></remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property IsDirty() As Boolean Implements IPersistentObject.IsDirty + Get + IsDirty = m_dirty + End Get + Set(ByVal Value As Boolean) + If Value = True Then + m_modifiedDate = Now 'Set modified date + 'Set milliseconds to zero to avoid issues with millisecond inconsistencies in SQL db's + m_modifiedDate = m_modifiedDate.AddMilliseconds(-m_modifiedDate.Millisecond) + If m_dirty = False Then + RaiseEvent MarkedAsDirty(Me, New EventArgs) + End If + End If + m_dirty = Value + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' The time (in minutes) that the object will remain in the cache before it is - ''' re-read from the database. - ''' </summary> - ''' <value>The expiry time period in minutes</value> - ''' <remarks>When an object is initially retrieved it is typically stored in the - ''' local object cache. Each object has a default expiry time of 30 minutes. During this - ''' time any attempts to retrieve the object will result in the cached copy being returned - ''' instead of the database being hit. - ''' <para>For some objects the 30 minute interval is too long or too short. By setting - ''' this value you can control when the cached version of the object will expire and - ''' thus force the database to be queried the next time the object is retrieved.</para> - ''' </remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property ExpiryInterval() As Double - Get - Return m_cacheExpiry - End Get - Set(ByVal Value As Double) - m_cacheExpiry = Value - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' The time (in minutes) that the object will remain in the cache before it is + ''' re-read from the database. + ''' </summary> + ''' <value>The expiry time period in minutes</value> + ''' <remarks>When an object is initially retrieved it is typically stored in the + ''' local object cache. Each object has a default expiry time of 30 minutes. During this + ''' time any attempts to retrieve the object will result in the cached copy being returned + ''' instead of the database being hit. + ''' <para>For some objects the 30 minute interval is too long or too short. By setting + ''' this value you can control when the cached version of the object will expire and + ''' thus force the database to be queried the next time the object is retrieved.</para> + ''' </remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property ExpiryInterval() As Double Implements IPersistentObject.ExpiryInterval + Get + Return m_cacheExpiry + End Get + Set(ByVal Value As Double) + m_cacheExpiry = Value + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' The ObjectID of the current object - ''' </summary> - ''' <value>The text representation of the object's OID</value> - ''' <remarks>Each object has an object ID regardless of wether those OID's are - ''' actually used in the database or not. This property will return the current - ''' OID value for the object. - ''' <para>If the object is persistent and OID's are used in the database the property - ''' will be the current OID value of the object. If the object is not persistent then - ''' the OID Value will be generated automatically.</para></remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property OIDValue() As String - Get - Dim oidfactory As COIDFactory - If m_oid Is Nothing Then - oidfactory = getOIDFactoryInstance() - m_oid = oidfactory.newOID - End If - OIDValue = m_oid.OID - End Get - Set(ByVal value As String) - If m_oid Is Nothing Then - m_oid = New COID - End If - m_oid.OID = value - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' The ObjectID of the current object + ''' </summary> + ''' <value>The text representation of the object's OID</value> + ''' <remarks>Each object has an object ID regardless of wether those OID's are + ''' actually used in the database or not. This property will return the current + ''' OID value for the object. + ''' <para>If the object is persistent and OID's are used in the database the property + ''' will be the current OID value of the object. If the object is not persistent then + ''' the OID Value will be generated automatically.</para></remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property OIDValue() As String Implements IPersistentObject.OIDValue + Get + Dim oidfactory As COIDFactory + If m_oid Is Nothing Then + oidfactory = getOIDFactoryInstance() + m_oid = oidfactory.newOID + End If + OIDValue = m_oid.OID + End Get + Set(ByVal value As String) + If m_oid Is Nothing Then + m_oid = New COID + End If + m_oid.OID = value + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' The GUID (Globally Unique Identifier) of the current object - ''' </summary> - ''' <value>The string representation of the object's GUID</value> - ''' <remarks>Each object has a GUID regardless of wether GUIDs are - ''' actually used in the database or not. This property will return the current - ''' GUID as a string. - ''' <para>If the object is persistent and GUIDs are used in the database the property - ''' will be the current GUID value of the object. If the object is not persistent then - ''' the GUID Value will be generated automatically.</para></remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property GUIDValue() As String - Get - If m_guid.Equals(Guid.Empty) Then - m_guid = Guid.NewGuid - End If - GUIDValue = m_guid.ToString("N") - End Get - Set(ByVal value As String) - m_guid = New Guid(value) - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' The GUID (Globally Unique Identifier) of the current object + ''' </summary> + ''' <value>The string representation of the object's GUID</value> + ''' <remarks>Each object has a GUID regardless of wether GUIDs are + ''' actually used in the database or not. This property will return the current + ''' GUID as a string. + ''' <para>If the object is persistent and GUIDs are used in the database the property + ''' will be the current GUID value of the object. If the object is not persistent then + ''' the GUID Value will be generated automatically.</para></remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property GUIDValue() As String Implements IPersistentObject.GUIDValue + Get + If m_guid.Equals(Guid.Empty) Then + m_guid = Guid.NewGuid + End If + GUIDValue = m_guid.ToString("N") + End Get + Set(ByVal value As String) + m_guid = New Guid(value) + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' The date that the object was originally created. - ''' </summary> - ''' <value>The created date of the current object</value> - ''' <remarks>If the created date is mapped to a database field then this value - ''' will be based on dates in the database. However, if the created date field is not - ''' mapped then the value will return todays date in most circumstances. - ''' <para>Note that typically the created date is mapped to a database field and is - ''' marked as a TimeStamp field to be used in creating and updating SQL data.</para></remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property CreatedDate() As Date - Get - Return m_createdDate - End Get - Set(ByVal Value As Date) - m_createdDate = Value - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' The date that the object was originally created. + ''' </summary> + ''' <value>The created date of the current object</value> + ''' <remarks>If the created date is mapped to a database field then this value + ''' will be based on dates in the database. However, if the created date field is not + ''' mapped then the value will return todays date in most circumstances. + ''' <para>Note that typically the created date is mapped to a database field and is + ''' marked as a TimeStamp field to be used in creating and updating SQL data.</para></remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property CreatedDate() As Date Implements IPersistentObject.CreatedDate + Get + Return m_createdDate + End Get + Set(ByVal Value As Date) + m_createdDate = Value + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' The modified date and time of an object. - ''' </summary> - ''' <value>The date and time that any attribute of an object was modified.</value> - ''' <remarks>This property is set whenever an object is marked as dirty, indicating - ''' that the object has changed. - ''' The value can be set manually but it is not recommended or neccessary.</remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property ModifiedDate() As Date - Get - Return m_modifiedDate - End Get - Set(ByVal Value As Date) - If m_modifiedDate <> Value Then - m_modifiedDate = Value - If m_originalModDate = m_blankDate Then - m_originalModDate = Value - End If - End If - End Set - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' The modified date and time of an object. + ''' </summary> + ''' <value>The date and time that any attribute of an object was modified.</value> + ''' <remarks>This property is set whenever an object is marked as dirty, indicating + ''' that the object has changed. + ''' The value can be set manually but it is not recommended or neccessary.</remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property ModifiedDate() As Date Implements IPersistentObject.ModifiedDate + Get + Return m_modifiedDate + End Get + Set(ByVal Value As Date) + If m_modifiedDate <> Value Then + m_modifiedDate = Value + If m_originalModDate = m_blankDate Then + m_originalModDate = Value + End If + End If + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Flag indicating that an objects AutoRetrieve associations have been retrieved. - ''' </summary> - ''' <value>Boolean indicating that associations have been retrieved</value> - ''' <remarks>If this flag is set then the object has been retrieved and all associations - ''' marked as AutoRetrieve-"true" have been processed and retrieved. - ''' <para>This flag is only used internally bu the framework and it should not be set manually.</para></remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public Property AssociationsLoaded() As Boolean - Get + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Flag indicating that an objects AutoRetrieve associations have been retrieved. + ''' </summary> + ''' <value>Boolean indicating that associations have been retrieved</value> + ''' <remarks>If this flag is set then the object has been retrieved and all associations + ''' marked as AutoRetrieve-"true" have been processed and retrieved. + ''' <para>This flag is only used internally bu the framework and it should not be set manually.</para></remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public Property AssociationsLoaded() As Boolean Implements IPersistentObject.AssociationsLoaded + Get If Me.getClassMap.AssociationMapCount > 0 Then Return m_associationsLoaded Else @@ -359,77 +360,77 @@ 'However if the object is not persistent then the associations can't be loaded Return Me.Persistent End If - End Get - Set(ByVal Value As Boolean) - m_associationsLoaded = Value - End Set - End Property + End Get + Set(ByVal Value As Boolean) + m_associationsLoaded = Value + End Set + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' The date that an object was last modified and saved to the persistent store. - ''' </summary> - ''' <value>The date and time that the object was last changed.</value> - ''' <remarks>When a persistent object is saved the original modified date is checked against - ''' the value in the database. If the dates are different we know that someone else - ''' has changed the object and that this object can no longer be saved. This forms the - ''' basis for the optimistic lock management performed by the framework. - ''' <para>Note that this funcitonality is only performed if the ModifiedDate attribute is - ''' mapped to a column in the database and is also marked as a Timestamp field.</para></remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public ReadOnly Property OriginalModifiedDate() As Date - Get - Return m_originalModDate - End Get - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' The date that an object was last modified and saved to the persistent store. + ''' </summary> + ''' <value>The date and time that the object was last changed.</value> + ''' <remarks>When a persistent object is saved the original modified date is checked against + ''' the value in the database. If the dates are different we know that someone else + ''' has changed the object and that this object can no longer be saved. This forms the + ''' basis for the optimistic lock management performed by the framework. + ''' <para>Note that this funcitonality is only performed if the ModifiedDate attribute is + ''' mapped to a column in the database and is also marked as a Timestamp field.</para></remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public ReadOnly Property OriginalModifiedDate() As Date + Get + Return m_originalModDate + End Get + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' The original date that the object was created - ''' </summary> - ''' <value></value> - ''' <remarks>This is for internal use only</remarks> - ''' <history> - ''' [rbanks] 25/11/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Browsable(False)> Public ReadOnly Property OriginalCreatedDate() As Date - Get - Return m_createdDate - End Get - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' The original date that the object was created + ''' </summary> + ''' <value></value> + ''' <remarks>This is for internal use only</remarks> + ''' <history> + ''' [rbanks] 25/11/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + <Browsable(False)> Public ReadOnly Property OriginalCreatedDate() As Date + Get + Return m_createdDate + End Get + End Property - ''' ----------------------------------------------------------------------------- - ''' <summary> - ''' Indicates if the object is currently being loaded by the persistence broker. - ''' </summary> - ''' <returns>Boolean indicating if the object is currently loading</returns> - ''' <remarks>When the persistence broker loads an object this flag will be set to - ''' indicate the object is currently loading. This flag can then be used inside - ''' subclasses to adjust behaviour accordingly. - ''' </remarks> - ''' <history> - ''' [rbanks] 16/08/2004 Created - ''' </history> - ''' ----------------------------------------------------------------------------- - <Browsable(False)> Public Property IsLoading() As Boolean - Get - Return m_isLoading - End Get - Set(ByVal Value As Boolean) - If m_isLoading <> Value Then - If Value = True Then - RaiseEvent LoadStarted(Me, New EventArgs) - Else - RaiseEvent LoadFinished(Me, New EventArgs) - End If - End If - m_isLoading = Value - End Set - End Property + ''' ----------------------------------------------------------------------------- + ''' <summary> + ''' Indicates if the object is currently being loaded by the persistence broker. + ''' </summary> + ''' <returns>Boolean indicating if the object is currently loading</returns> + ''' <remarks>When the persistence broker loads an object this flag will be set to + ''' indicate the object is currently loading. This flag can then be used inside + ''' subclasses to adjust behaviour accordingly. + ''' </remarks> + ''' <history> + ''' [rbanks] 16/08/2004 Created + ''' </history> + ''' ----------------------------------------------------------------------------- + <Browsable(False)> Public Property IsLoading() As Boolean Implements IPersistentObject.IsLoading + Get + Return m_isLoading + End Get + Set(ByVal Value As Boolean) + If m_isLoading <> Value Then + If Value = True Then + RaiseEvent LoadStarted(Me, New EventArgs) + Else + RaiseEvent LoadFinished(Me, New EventArgs) + End If + End If + m_isLoading = Value + End Set + End Property <Browsable(False)> Friend Property OriginalCacheKey() As CCacheKey Get @@ -582,7 +583,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public MustOverride Function getNewObject() As CPersistentObject + Public MustOverride Function getNewObject() As CPersistentObject Implements IPersistentObject.getNewObject '''----------------------------------------------------------------------------- ''' <summary> @@ -709,7 +710,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function getClassMap() As CClassMap + Public Function getClassMap() As CClassMap Implements IPersistentObject.getClassMap Dim persistenceBroker As CPersistenceBroker If m_classmap Is Nothing Then persistenceBroker = getPersistenceBrokerInstance() @@ -763,7 +764,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Function Retrieve(ByRef obj As CPersistentObject, ByVal useCache As Boolean) As Boolean + Public Overridable Function Retrieve(ByRef obj As CPersistentObject, ByVal useCache As Boolean) As Boolean Implements IPersistentObject.Retrieve Dim persistentBroker As CPersistenceBroker persistentBroker = getPersistenceBrokerInstance() Return persistentBroker.retrieveObject(obj, False, useCache) @@ -786,7 +787,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Function Retrieve(ByRef obj As CPersistentObject) As Boolean + Public Overridable Function Retrieve(ByRef obj As CPersistentObject) As Boolean Implements IPersistentObject.Retrieve Return Retrieve(obj, True) End Function @@ -808,7 +809,7 @@ ''' [rbanks] 16/08/2004 Created ''' </history> ''' ----------------------------------------------------------------------------- - Public Overridable Function Retrieve() As Boolean + Public Overridable Function Retrieve() As Boolean Implements IPersistentObject.Retrieve Dim x As Boolean Dim obj As CPersistentObject obj = Me.getNewObject @@ -846,7 +847,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Sub Save(ByVal obj As CPersistentObject, ByVal checkAssociationsRecursivly As Boolean) + Public Overridable Sub Save(ByVal obj As CPersistentObject, ByVal checkAssociationsRecursivly As Boolean) Implements IPersistentObject.save Dim persistentBroker As CPersistenceBroker Dim value As CPersistentObject Dim queue As Queue @@ -884,11 +885,11 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Sub Save() + Public Overridable Sub Save() Implements IPersistentObject.save Save(Me, False) End Sub - Public Overridable Sub Save(ByVal checkAssociationsRecursively As Boolean) + Public Overridable Sub Save(ByVal checkAssociationsRecursively As Boolean) Implements IPersistentObject.save Save(Me, checkAssociationsRecursively) End Sub @@ -906,7 +907,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Sub Delete(ByVal obj As CPersistentObject) + Public Overridable Sub Delete(ByVal obj As CPersistentObject) Implements IPersistentObject.Delete Delete(obj, False) End Sub @@ -924,7 +925,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Sub Delete(ByVal obj As CPersistentObject, ByVal deleteSuperClass As Boolean) + Public Overridable Sub Delete(ByVal obj As CPersistentObject, ByVal deleteSuperClass As Boolean) Implements IPersistentObject.Delete If obj.isReadOnly Then Throw New DeleteException("This class is read only. No modifications can be made.") Return @@ -947,11 +948,11 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Sub Delete() + Public Overridable Sub Delete() Implements IPersistentObject.Delete Delete(Me, False) End Sub - Public Overridable Sub Delete(ByVal deleteSuperClass As Boolean) + Public Overridable Sub Delete(ByVal deleteSuperClass As Boolean) Implements IPersistentObject.Delete Delete(Me, deleteSuperClass) End Sub @@ -964,7 +965,7 @@ ''' [mfo] 27/09/2004 Created ''' </history> ''' ----------------------------------------------------------------------------- - Public Overridable Sub deleteAll() + Public Overridable Sub DeleteAll() Implements IPersistentObject.DeleteAll Dim obj As CPersistentObject Dim obRC As CRetrieveCriteria Dim obCursor As CCursor @@ -994,7 +995,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Function Find(ByRef obj As CPersistentObject, ByVal useCache As Boolean) As Boolean + Public Overridable Function Find(ByRef obj As CPersistentObject, ByVal useCache As Boolean) As Boolean Implements IPersistentObject.find Dim persistentBroker As CPersistenceBroker persistentBroker = getPersistenceBrokerInstance() Find = persistentBroker.retrieveObject(obj, True, useCache) @@ -1013,7 +1014,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Function Find(ByRef obj As CPersistentObject) As Boolean + Public Overridable Function Find(ByRef obj As CPersistentObject) As Boolean Implements IPersistentObject.find Return Find(obj, True) End Function @@ -1035,7 +1036,7 @@ ''' [rbanks] 16/08/2004 Created ''' </history> ''' ----------------------------------------------------------------------------- - Public Overridable Function Find() As Boolean + Public Overridable Function Find() As Boolean Implements IPersistentObject.find Dim x As Boolean Dim obj As CPersistentObject obj = Me.getNewObject @@ -1089,7 +1090,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public MustOverride Function IsValid() As Boolean + Public MustOverride Function IsValid() As Boolean Implements IPersistentObject.IsValid '''----------------------------------------------------------------------------- ''' <summary> @@ -1173,7 +1174,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Overridable Function Copy() As CPersistentObject + Public Overridable Function Copy() As CPersistentObject Implements IPersistentObject.Copy Return Me.MemberwiseClone End Function @@ -1233,7 +1234,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function getFieldLengthByName(ByVal x As String) As Integer + Public Function getFieldLengthByName(ByVal x As String) As Integer Implements IPersistentObject.getFieldLengthByName Return Me.getClassMap(Me).getAttributeMapByString(x, True).ColumnMap.StorageSize() End Function @@ -1248,7 +1249,7 @@ ''' [rbanks] 26/11/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function getFieldTypeByName(ByVal x As String) As Type + Public Function getFieldTypeByName(ByVal x As String) As Type Implements IPersistentObject.getFieldTypeByName Return Me.getClassMap(Me).getAttributeMapByString(x, True).ColumnMap.StorageType End Function @@ -1456,7 +1457,7 @@ ''' [rbanks] 18/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - Public Function IsReferenced() As Boolean + Public Function IsReferenced() As Boolean Implements IPersistentObject.IsReferenced Dim obAssociation As CUDAMap Dim obObjectCol As CPersistentCollection Dim colAttributes As Collection |
From: Richard B. <rb...@us...> - 2004-10-12 23:10:27
|
Update of /cvsroot/jcframework/FrameworkMapper/Images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv697/Images Added Files: Class.ico Database.ico OpenFolder.ICO Property.ico SQLColumn.ico SQLTable.ico SQLView.ico Log Message: Initial Import of sources. --- NEW FILE: Class.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: SQLView.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Property.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Database.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: OpenFolder.ICO --- (This appears to be a binary file; contents omitted.) --- NEW FILE: SQLColumn.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: SQLTable.ico --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/jcframework/FrameworkMapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv697 Added Files: AssemblyInfo.vb AtomsFrameworkMapper.sln CAssociationEntry.vb CAssociationEntryCollection.vb CAttributeList.vb CMappedAssociation.vb CMappedAttribute.vb CMappedAttributeCollection.vb CMappedClass.vb CMappedClassCollection.vb CMappedDatabase.vb COptions.vb CProject.vb FrameworkMapper.vbproj FrmMain.resx FrmMain.vb MappedDatabaseList.vb README.txt XMLMapper.vb frmAddDatabase.resx frmAddDatabase.vb frmClassInfo.resx frmClassInfo.vb frmClasses.resx frmClasses.vb frmDatabases.resx frmDatabases.vb frmOptions.resx frmOptions.vb frmProjectProperties.resx frmProjectProperties.vb frmProperties.resx frmProperties.vb Log Message: Initial Import of sources. --- NEW FILE: CMappedClassCollection.vb --- Public Class CMappedClassCollection Inherits CollectionBase Public Sub Add(ByVal a As CMappedClass) list.Add(a) End Sub Public Sub Remove(ByVal index As Integer) If index > Count - 1 Or index < 0 Then Throw New Exception("index value is outside of bounds") End If list.RemoveAt(index) End Sub Public Sub Remove(ByVal value As CMappedClass) list.Remove(value) End Sub Default Public ReadOnly Property Item(ByVal index As Integer) As CMappedClass Get Return CType(list.Item(index), CMappedClass) End Get End Property Default Public ReadOnly Property Item(ByVal _name As String) As CMappedClass Get For Each ma As CMappedClass In Me If ma.ClassName = _name Then Return ma End If Next End Get End Property End Class --- NEW FILE: CMappedDatabase.vb --- Public Class CMappedDatabase Public dbname As String Public dbType As String Public serverName As String Public user As String Public password As String Public OIDTable As String Public portNumber As String Public options As String Public NameParam As String Public Expanded As Boolean Public tables As New Collection Public Sub getDBSchema() Select Case dbType Case "CMSSQLDatabase" GetMSSQLDB() Case Else End Select End Sub Private Sub GetMSSQLDB() Dim conn As New SqlClient.SqlConnection Try 'If user Is Nothing OrElse user.Length = 0 Then ' m_user = "" ' m_password = "" ' GetLoginDetails(m_user, m_password) 'End If conn.ConnectionString = _ "Data Source=" & serverName & ";" & _ "Initial Catalog=" & NameParam & ";" & _ "Integrated Security=false;" & _ "Persist Security Info=False;" & _ "User Id=" & user & ";" & _ "Password=" & password conn.Open() Catch ex As SqlClient.SqlException MsgBox("Connection to " & serverName & " couldn't be established") Return End Try Dim schemaDA As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.TABLES " & _ "ORDER BY TABLE_TYPE, TABLE_NAME", _ conn) Dim schemaTable As DataTable = New DataTable schemaDA.Fill(schemaTable) tables = New Collection Dim table As dbTable Dim col As dbColumn For Each dr As DataRow In schemaTable.Rows table = New dbTable table.tableName = dr("TABLE_NAME") table.tableOwner = dr("TABLE_SCHEMA") If dr("TABLE_TYPE") = "BASE TABLE" Then table.tableType = "TABLE" Else table.tableType = "VIEW" End If table.parentDB = Me tables.Add(table, table.ToString) Dim fieldDA As SqlClient.SqlDataAdapter = _ New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.COLUMNS " & _ "where table_schema = '" & dr("TABLE_SCHEMA") & "' and Table_name = '" & dr("TABLE_NAME") & "' " & _ "ORDER BY ORDINAL_POSITION", _ conn) Dim schemaTableCols As DataTable = New DataTable fieldDA.Fill(schemaTableCols) For Each colrow As DataRow In schemaTableCols.Rows col = New dbColumn col.colName = colrow("COLUMN_NAME") col.colType = colrow("DATA_TYPE") Select Case col.colType Case "bigint" col.dotnetTypeName = "long" Case "binary" col.dotnetTypeName = "Object" Case "bit" col.dotnetTypeName = "Boolean" Case "char" col.dotnetTypeName = "String" Case "datetime" col.dotnetTypeName = "DateTime" Case "decimal" col.dotnetTypeName = "Decimal" Case "float" col.dotnetTypeName = "Double" Case "image" col.dotnetTypeName = "Byte()" Case "int" col.dotnetTypeName = "Integer" Case "money" col.dotnetTypeName = "Decimal" Case "nchar" col.dotnetTypeName = "String" Case "ntext" col.dotnetTypeName = "String" Case "numeric" col.dotnetTypeName = "Decimal" Case "nvarchar" col.dotnetTypeName = "String" Case "real" col.dotnetTypeName = "Single" Case "smalldatetime" col.dotnetTypeName = "DateTime" Case "smallint" col.dotnetTypeName = "Short" Case "smallmoney" col.dotnetTypeName = "Decimal" Case "text" col.dotnetTypeName = "String" Case "timestamp" col.dotnetTypeName = "Byte()" Case "tinyint" col.dotnetTypeName = "Byte" Case "uniqueidentifier" col.dotnetTypeName = "Guid" Case "varbinary" col.dotnetTypeName = "Byte()" Case "varchar" col.dotnetTypeName = "String" Case "sql_variant" col.dotnetTypeName = "Object" End Select col.parentTable = table table.columns.Add(col, col.colName) Next Dim constraintDA As SqlClient.SqlDataAdapter = _ New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " & _ "where table_schema = '" & dr("TABLE_SCHEMA") & "' and Table_name = '" & dr("TABLE_NAME") & "' " & _ "and CONSTRAINT_TYPE = 'PRIMARY KEY'", conn) Dim TableConstraintCols As DataTable = New DataTable constraintDA.Fill(TableConstraintCols) If TableConstraintCols.Rows.Count > 0 Then Dim constraintRow As DataRow = TableConstraintCols.Rows(0) Dim cname As String = constraintRow("CONSTRAINT_NAME") Dim primaryKeyDA As SqlClient.SqlDataAdapter = _ New SqlClient.SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE " & _ "where table_schema = '" & dr("TABLE_SCHEMA") & "' and Table_name = '" & dr("TABLE_NAME") & "' " & _ "and CONSTRAINT_NAME = '" & cname & "'", conn) Dim constraintCols As DataTable = New DataTable primaryKeyDA.Fill(constraintCols) For Each conColrow As DataRow In constraintCols.Rows col = table.columns(conColrow("COLUMN_NAME")) col.isPrimaryKey = True Next End If Next End Sub End Class Public Class dbTable Public tableName As String Public tableOwner As String Public parentDB As CMappedDatabase Public Expanded As Boolean Public columns As New Collection Public tableType As String Public Overrides Function ToString() As String Return tableOwner & "." & tableName End Function End Class Public Class dbColumn Public colName As String Public colType As String Public dotnetTypeName As String Public parentTable As dbTable Public isPrimaryKey As Boolean End Class --- NEW FILE: XMLMapper.vb --- Option Strict Off Option Explicit On Imports System.Collections.Specialized Imports System.Xml Public Class CXMLMapper Private m_FileName As String Private p As CProject Public Sub New(ByVal xmlFile As String, ByRef inProj As CProject) MyBase.New() m_FileName = xmlFile p = inProj End Sub Public Sub Load() p.databases = New Collection p.classes = New CMappedClassCollection Dim doc As New XmlDocument Try doc.Load(m_FileName) Catch ex As Exception Exit Sub End Try Dim node As XmlNode Dim elem As XmlElement Dim reldb As CMappedDatabase Dim clm As CMappedClass Dim elementRoot As XmlElement elementRoot = doc.DocumentElement node = elementRoot.FirstChild While Not node Is Nothing If node.NodeType = XmlNodeType.Element Then elem = node If node.Name = "database" Then reldb = getRelationalDatabase(elem) Try p.databases.Add(reldb, reldb.dbname) Catch ex As Exception Throw New Exception("Could not add database " & reldb.dbname & vbCrLf & ex.Message, ex) End Try ElseIf node.Name = "class" Then clm = getClassMap(elem) Try p.classes.Add(clm) Catch ex As Exception Throw New Exception("Could not add classmap " & clm.ClassName & vbCrLf & ex.Message, ex) End Try ElseIf node.Name = "association" Then processAssociation(elem) End If End If node = node.NextSibling() End While End Sub Private Function getRelationalDatabase(ByRef node As XmlElement) As CMappedDatabase Dim relDb As CMappedDatabase relDb = Nothing Dim attrPMName As String Dim attrClassName As XmlAttribute attrPMName = node.GetAttribute("name") attrClassName = node.GetAttributeNode("class") Dim params As HybridDictionary Dim nodeChild As XmlNode Dim elementChild As XmlElement Dim attrName, attrValue As XmlAttribute If ((Not attrPMName Is Nothing) And (Not attrClassName Is Nothing)) Then relDb = New CMappedDatabase relDb.dbType = attrClassName.Value relDb.dbname = attrPMName nodeChild = node.FirstChild() Do While Not nodeChild Is Nothing If nodeChild.NodeType = XmlNodeType.Element Then elementChild = nodeChild If elementChild.Name = "parameter" Then attrName = elementChild.GetAttributeNode("name") attrValue = elementChild.GetAttributeNode("value") Select Case attrName.Value Case "name" relDb.NameParam = attrValue.Value Case "serverName" relDb.serverName = attrValue.Value Case "user" relDb.user = attrValue.Value Case "password" If attrValue.Value = "N/A" Then relDb.password = Nothing Else relDb.password = attrValue.Value End If Case "OIDTable" relDb.OIDTable = attrValue.Value Case "port" relDb.portNumber = attrValue.Value Case "options" relDb.options = attrValue.Value End Select End If End If nodeChild = nodeChild.NextSibling Loop End If relDb.getDBSchema() Return relDb End Function Private Function getClassMap(ByVal node As XmlElement) As CMappedClass Dim attrClassName As XmlAttribute, attrTable As XmlAttribute, attrTableOwner As XmlAttribute Dim attrDatabase As XmlAttribute, attrSuperClassName As XmlAttribute, attrReadOnly As XmlAttribute, attrModifyOnly As XmlAttribute Dim attrClassNameSpace As XmlAttribute Dim attrSharedField As XmlAttribute, attrSharedValue As XmlAttribute attrClassName = node.GetAttributeNode("name") attrTable = node.GetAttributeNode("table") attrDatabase = node.GetAttributeNode("database") attrSuperClassName = node.GetAttributeNode("superclass") attrReadOnly = node.GetAttributeNode("readonly") attrModifyOnly = node.GetAttributeNode("modifyonly") attrTableOwner = node.GetAttributeNode("owner") attrSharedField = node.GetAttributeNode("sharedtablefield") attrSharedValue = node.GetAttributeNode("sharedtablevalue") attrClassNameSpace = node.GetAttributeNode("namespace") Dim ClassMap As CMappedClass Dim dbMap As CMappedDatabase Dim nodeChild As XmlNode Dim elementChild As XmlElement Dim AttrMap As CMappedAttribute If ((Not attrClassName Is Nothing) And (Not attrDatabase Is Nothing)) Then ClassMap = New CMappedClass ClassMap.Project = p ClassMap.ClassName = attrClassName.Value If Not attrSuperClassName Is Nothing Then ClassMap.SuperClass = p.classes.Item(attrSuperClassName.Value) If Not attrSharedValue Is Nothing Then ClassMap.SharedValue = attrSharedValue.Value End If If Not attrSharedField Is Nothing Then ClassMap.SharedField = attrSharedField.Value End If End If If attrReadOnly Is Nothing Then ClassMap.ReadOnlyFlag = False Else ClassMap.ReadOnlyFlag = attrReadOnly.Value End If If attrModifyOnly Is Nothing Then ClassMap.ModifyOnlyFlag = False Else ClassMap.ModifyOnlyFlag = attrModifyOnly.Value End If If Not attrClassNameSpace Is Nothing Then ClassMap.ClassNameSpace = attrClassNameSpace.Value End If ClassMap.Database = p.databases.Item(attrDatabase.Value) ClassMap.Table = attrTable.Value If attrTableOwner Is Nothing Then ClassMap.TableOwner = "dbo" Else ClassMap.TableOwner = attrTableOwner.Value End If If Not ClassMap.Database Is Nothing Then For Each tbl As dbTable In ClassMap.Database.tables If tbl.tableName = ClassMap.Table AndAlso tbl.tableOwner = ClassMap.TableOwner Then ClassMap.MappedTable = tbl End If Next End If nodeChild = node.FirstChild Do While Not nodeChild Is Nothing If nodeChild.NodeType = XmlNodeType.Element Then elementChild = nodeChild If elementChild.Name = "attribute" Then AttrMap = getAttributeMap(elementChild, ClassMap) If Not AttrMap.Column Is Nothing AndAlso Not ClassMap.MappedTable Is Nothing Then For Each col As dbColumn In ClassMap.MappedTable.columns If col.colName = AttrMap.Column Then AttrMap.MappedColumn = col AttrMap.DataType = col.colType End If Next End If ClassMap.Attributes.Add(AttrMap) End If End If nodeChild = nodeChild.NextSibling Loop End If getClassMap = ClassMap End Function Private Function getAttributeMap(ByVal node As XmlElement, ByVal clMap As CMappedClass) As CMappedAttribute Dim attrColumn, attrName, attrKey, attrFind, attrProxy, attrTimeStamp, attrIdentity As XmlAttribute Dim attrReference As XmlAttribute attrName = node.GetAttributeNode("name") attrColumn = node.GetAttributeNode("column") attrKey = node.GetAttributeNode("key") attrReference = node.GetAttributeNode("reference") attrFind = node.GetAttributeNode("find") attrProxy = node.GetAttributeNode("proxy") attrTimeStamp = node.GetAttributeNode("timestamp") attrIdentity = node.GetAttributeNode("identity") Dim AttrMap As CMappedAttribute Dim refAttr As CMappedAttribute If Not attrName Is Nothing Then AttrMap = New CMappedAttribute AttrMap.Name = attrName.Value AttrMap.isKey = False If Not attrColumn Is Nothing Then AttrMap.Column = attrColumn.Value If Not attrKey Is Nothing Then If UCase(attrKey.Value) = "PRIMARY" Then AttrMap.isKey = True End If End If If Not attrFind Is Nothing Then AttrMap.isFind = CBool(attrFind.Value) End If If Not attrIdentity Is Nothing Then AttrMap.isIdentity = CBool(attrIdentity.Value) End If If Not attrTimeStamp Is Nothing Then AttrMap.isTimeStamp = CBool(attrTimeStamp.Value) Else AttrMap.isTimeStamp = False ' Default is not a timestamp End If End If If Not attrProxy Is Nothing Then AttrMap.isProxy = CBool(attrProxy.Value) Else AttrMap.isProxy = True End If If ((Not attrReference Is Nothing) And (Not clMap.SuperClass Is Nothing)) Then refAttr = clMap.SuperClass.Attributes.Item(attrReference.Value) If Not refAttr Is Nothing Then AttrMap.Reference = refAttr.Name End If End If getAttributeMap = AttrMap End If End Function Private Sub processAssociation(ByVal node As XmlElement) Dim attrToClass, attrFromClass, attrTarget As Object Dim attrCardinality As XmlAttribute Dim fromClassMap As CMappedClass Dim toClassMap As CMappedClass Dim udaAm As CMappedAssociation Dim nodeChild As XmlNode Dim elementChild As XmlElement Dim entry As CAssociationEntry Dim amFromAttribute As Object Dim amToAttribute As CMappedAttribute Dim attrFromAttribute As Object Dim attrToAttribute As XmlAttribute Dim attrName As XmlAttribute attrFromClass = node.GetAttributeNode("fromClass") attrToClass = node.GetAttributeNode("toClass") attrTarget = node.GetAttributeNode("target") attrCardinality = node.GetAttributeNode("cardinality") attrName = node.GetAttributeNode("name") If ((Not attrFromClass Is Nothing) And (Not attrToClass Is Nothing) And (Not attrTarget Is Nothing)) Then fromClassMap = p.classes.Item(attrFromClass.Value) toClassMap = p.classes.Item(attrToClass.Value) udaAm = New CMappedAssociation udaAm.fromClass = fromClassMap udaAm.toClass = toClassMap udaAm.targetAttribute = fromClassMap.Attributes.Item(attrTarget.Value) udaAm.deleteAuto = node.GetAttributeNode("deleteAutomatic").Value udaAm.saveAuto = node.GetAttributeNode("saveAutomatic").Value udaAm.retrieveAuto = node.GetAttributeNode("retrieveAutomatic").Value If attrName Is Nothing Then udaAm.name = udaAm.targetAttribute.Name Else udaAm.name = attrName.Value End If If Not attrCardinality Is Nothing Then If UCase(attrCardinality.Value) = "ONETOONE" Then udaAm.Cardinality = Cardinalities.OneToOne ElseIf UCase(attrCardinality.Value) = "ONETOMANY" Then udaAm.Cardinality = Cardinalities.OneToMany End If End If nodeChild = node.FirstChild Do While Not nodeChild Is Nothing If nodeChild.NodeType = XmlNodeType.Element Then elementChild = nodeChild If elementChild.Name = "entry" Then attrFromAttribute = elementChild.GetAttributeNode("fromAttribute") attrToAttribute = elementChild.GetAttributeNode("toAttribute") If ((Not attrFromAttribute Is Nothing) And (Not attrToAttribute Is Nothing)) Then amFromAttribute = fromClassMap.Attributes.Item(attrFromAttribute.Value) amToAttribute = toClassMap.Attributes.Item(attrToAttribute.Value) If amFromAttribute Is Nothing Then Throw New Exception("Error in association definition") End If If amToAttribute Is Nothing Then Throw New Exception("Error in association definition") End If entry = New CAssociationEntry entry.fromAttribute = amFromAttribute entry.toAttribute = amToAttribute udaAm.entries.Add(entry) End If End If End If nodeChild = nodeChild.NextSibling Loop fromClassMap.Associations.Add(udaAm, udaAm.name) Else Throw New Exception("Error in association definition: Missing FromClass, ToClass or Target attributes") End If End Sub Public Sub Save() Dim doc As New XmlDocument Dim elem As XmlElement Dim node As XmlNode Dim attr As XmlAttribute node = doc.CreateElement("map") For Each db As CMappedDatabase In p.databases elem = doc.CreateElement("database") saveDatabase(doc, elem, db) node.AppendChild(elem) Next For Each cls As CMappedClass In p.classes elem = doc.CreateElement("class") saveClass(doc, elem, cls) node.AppendChild(elem) Next For Each cls As CMappedClass In p.classes For Each ass As CMappedAssociation In cls.Associations elem = doc.CreateElement("association") saveassociation(doc, elem, ass) node.AppendChild(elem) Next Next doc.AppendChild(node) doc.Save(m_FileName) End Sub Private Sub saveDatabase(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal db As CMappedDatabase) Dim attr As XmlAttribute Dim param As XmlElement 'db name CreateAttributeValue(doc, elem, "name", db.dbname) CreateAttributeValue(doc, elem, "class", db.dbType) 'Now add parameters If db.NameParam <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "name") CreateAttributeValue(doc, param, "value", db.NameParam) elem.AppendChild(param) End If If db.serverName <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "serverName") CreateAttributeValue(doc, param, "value", db.serverName) elem.AppendChild(param) End If If db.user <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "user") CreateAttributeValue(doc, param, "value", db.user) elem.AppendChild(param) End If If db.password <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "password") CreateAttributeValue(doc, param, "value", db.password) elem.AppendChild(param) End If If db.OIDTable <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "OIDTable") CreateAttributeValue(doc, param, "value", db.OIDTable) elem.AppendChild(param) End If If db.portNumber <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "port") CreateAttributeValue(doc, param, "value", db.portNumber) elem.AppendChild(param) End If If db.options <> String.Empty Then param = doc.CreateElement("parameter") CreateAttributeValue(doc, param, "name", "options") CreateAttributeValue(doc, param, "value", db.options) elem.AppendChild(param) End If End Sub Private Sub SaveClass(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal cls As CMappedClass) Dim mappedAttr As XmlElement CreateAttributeValue(doc, elem, "name", cls.ClassName) CreateAttributeValue(doc, elem, "table", cls.Table) CreateAttributeValue(doc, elem, "database", cls.DatabaseName) If cls.TableOwner <> "dbo" AndAlso cls.TableOwner <> String.Empty Then CreateAttributeValue(doc, elem, "owner", cls.TableOwner) End If If Not cls.SuperClass Is Nothing Then CreateAttributeValue(doc, elem, "superclass", cls.SuperClass.ClassName) If cls.SharedField <> String.Empty Then CreateAttributeValue(doc, elem, "sharedtablefield", cls.SharedField) CreateAttributeValue(doc, elem, "sharedtablevalue", cls.SharedValue) End If End If If cls.ReadOnlyFlag Then CreateAttributeValue(doc, elem, "readonly", "true") End If If cls.ModifyOnlyFlag Then CreateAttributeValue(doc, elem, "modifyonly", "true") End If If cls.ClassNameSpace <> String.Empty Then CreateAttributeValue(doc, elem, "namespace", cls.ClassNameSpace) End If For Each attr As CMappedAttribute In cls.Attributes mappedAttr = doc.CreateElement("attribute") CreateAttributeValue(doc, mappedAttr, "name", attr.Name) If attr.Column <> String.Empty Then CreateAttributeValue(doc, mappedAttr, "column", attr.Column) End If If attr.isKey Then CreateAttributeValue(doc, mappedAttr, "key", "primary") End If If attr.isFind Then CreateAttributeValue(doc, mappedAttr, "find", "true") End If If attr.Reference <> String.Empty Then CreateAttributeValue(doc, mappedAttr, "reference", attr.Reference) End If If attr.isProxy = False Then CreateAttributeValue(doc, mappedAttr, "proxy", "false") End If If attr.isTimeStamp Then CreateAttributeValue(doc, mappedAttr, "timestamp", "true") End If If attr.isIdentity Then CreateAttributeValue(doc, mappedAttr, "identity", "true") End If elem.AppendChild(mappedAttr) Next End Sub Private Sub SaveAssociation(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal ass As CMappedAssociation) Dim assEntry As XmlElement CreateAttributeValue(doc, elem, "fromClass", ass.fromClass.ClassName) CreateAttributeValue(doc, elem, "toClass", ass.ToClass.ClassName) If ass.TargetAttribute Is Nothing Then CreateAttributeValue(doc, elem, "target", "No Target") Else CreateAttributeValue(doc, elem, "target", ass.TargetAttribute.Name) End If If ass.Cardinality = Cardinalities.OneToOne Then CreateAttributeValue(doc, elem, "cardinality", "OneToOne") Else CreateAttributeValue(doc, elem, "cardinality", "OneToMany") End If If ass.Name <> ass.TargetAttribute.Name Then CreateAttributeValue(doc, elem, "name", ass.Name) End If If ass.RetrieveAuto Then CreateAttributeValue(doc, elem, "retrieveAutomatic", "true") Else CreateAttributeValue(doc, elem, "retrieveAutomatic", "false") End If If ass.SaveAuto Then CreateAttributeValue(doc, elem, "saveAutomatic", "true") Else CreateAttributeValue(doc, elem, "saveAutomatic", "false") End If If ass.DeleteAuto Then CreateAttributeValue(doc, elem, "deleteAutomatic", "true") Else CreateAttributeValue(doc, elem, "deleteAutomatic", "false") End If For Each e As CAssociationEntry In ass.Entries assEntry = doc.CreateElement("entry") CreateAttributeValue(doc, assEntry, "fromAttribute", e.fromAttribute.Name) CreateAttributeValue(doc, assEntry, "toAttribute", e.toAttribute.Name) elem.AppendChild(assEntry) Next End Sub Private Sub CreateAttributeValue(ByVal doc As XmlDocument, ByVal elem As XmlElement, ByVal name As String, ByVal value As String) Dim attr As XmlAttribute attr = doc.CreateAttribute(name) attr.Value = value elem.Attributes.Append(attr) End Sub End Class --- NEW FILE: AssemblyInfo.vb --- Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes. Change these attribute values to modify the information ' associated with an assembly. ' Review the values of the assembly attributes <Assembly: AssemblyTitle("")> <Assembly: AssemblyDescription("")> <Assembly: AssemblyCompany("")> <Assembly: AssemblyProduct("")> <Assembly: AssemblyCopyright("")> <Assembly: AssemblyTrademark("")> <Assembly: CLSCompliant(True)> 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("FD5B735C-1090-41C9-B094-E0E8EF75593C")> ' Version information for an assembly consists of the following four values: ' ' Major Version ' Minor Version ' Build Number ' Revision ' ' You can specify all the values or you can default the Build and Revision Numbers ' by using the '*' as shown below: <Assembly: AssemblyVersion("1.0.*")> --- NEW FILE: frmProjectProperties.resx --- <?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used forserialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="Label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="TextBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="TextBox2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Button1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Button2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Button2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="TextBox3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="TextBox3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="cmbTemplateSet.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="cmbTemplateSet.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="cmbTemplateSet.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label4.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="Label4.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="Label4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>(Default)</value> </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Name"> <value>frmProjectProperties</value> </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>2, 2</value> </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> AAABAAIAICAQAAAAAADoAgAAJgAAABAQAAAAAAAAaAUAAA4DAAAoAAAAIAAAAEAAAAABAAQAAAAAAAAC AAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/ AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //8oAAAAEAAAACAAAAABAAgAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAgAAAAICAAIAA AACAAIAAgIAAAMDAwADA3MAA8MqmAAQEBAAICAgADAwMABEREQAWFhYAHBwcACIiIgApKSkAVVVVAE1N TQBCQkIAOTk5AIB8/wBQUP8AkwDWAP/szADG1u8A1ufnAJCprQAAADMAAABmAAAAmQAAAMwAADMAAAAz MwAAM2YAADOZAAAzzAAAM/8AAGYAAABmMwAAZmYAAGaZAABmzAAAZv8AAJkAAACZMwAAmWYAAJmZAACZ zAAAmf8AAMwAAADMMwAAzGYAAMyZAADMzAAAzP8AAP9mAAD/mQAA/8wAMwAAADMAMwAzAGYAMwCZADMA zAAzAP8AMzMAADMzMwAzM2YAMzOZADMzzAAzM/8AM2YAADNmMwAzZmYAM2aZADNmzAAzZv8AM5kAADOZ MwAzmWYAM5mZADOZzAAzmf8AM8wAADPMMwAzzGYAM8yZADPMzAAzzP8AM/8zADP/ZgAz/5kAM//MADP/ /wBmAAAAZgAzAGYAZgBmAJkAZgDMAGYA/wBmMwAAZjMzAGYzZgBmM5kAZjPMAGYz/wBmZgAAZmYzAGZm ZgBmZpkAZmbMAGaZAABmmTMAZplmAGaZmQBmmcwAZpn/AGbMAABmzDMAZsyZAGbMzABmzP8AZv8AAGb/ MwBm/5kAZv/MAMwA/wD/AMwAmZkAAJkzmQCZAJkAmQDMAJkAAACZMzMAmQBmAJkzzACZAP8AmWYAAJlm MwCZM2YAmWaZAJlmzACZM/8AmZkzAJmZZgCZmZkAmZnMAJmZ/wCZzAAAmcwzAGbMZgCZzJkAmczMAJnM /wCZ/wAAmf8zAJnMZgCZ/5kAmf/MAJn//wDMAAAAmQAzAMwAZgDMAJkAzADMAJkzAADMMzMAzDNmAMwz mQDMM8wAzDP/AMxmAADMZjMAmWZmAMxmmQDMZswAmWb/AMyZAADMmTMAzJlmAMyZmQDMmcwAzJn/AMzM AADMzDMAzMxmAMzMmQDMzMwAzMz/AMz/AADM/zMAmf9mAMz/mQDM/8wAzP//AMwAMwD/AGYA/wCZAMwz AAD/MzMA/zNmAP8zmQD/M8wA/zP/AP9mAAD/ZjMAzGZmAP9mmQD/ZswAzGb/AP+ZAAD/mTMA/5lmAP+Z mQD/mcwA/5n/AP/MAAD/zDMA/8xmAP/MmQD/zMwA/8z/AP//MwDM/2YA//+ZAP//zABmZv8AZv9mAGb/ /wD/ZmYA/2b/AP//ZgAhAKUAX19fAHd3dwCGhoYAlpaWAMvLywCysrIA19fXAN3d3QDj4+MA6urqAPHx 8QD4+PgA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAoKCgoKCgoKCgoKCgoK CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoK CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/////////////CgoKCgoK/woK/woKCgoK/woKCgoKCv////// ///s//8KCgoKCgr/Cgr///8KBwr/CgoKCgoK/woHCv8KBwoHCgoKBAQKCv//CgcKBwoHCgcHCgQECgoK CgoKBwoHCgcHBwcEBAoKCgoKCgoHCgcHBwcHBAQKCgoKCgoKCgcHBwcHCgQECgoKCgoKCgoKCgoKCgoE BAr//wAA//8AAP//AAD//wAA//8AAAAPAAAADwAAAA8AAAAPAAAADwAAAAkAAAABAAAAAQAA+AEAAPwB AAD+CQAA </value> </data> </root> --- NEW FILE: frmOptions.vb --- Imports System.IO Public Class frmOptions Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents txtTemplateDir As System.Windows.Forms.TextBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Label1 = New System.Windows.Forms.Label Me.txtTemplateDir = New System.Windows.Forms.TextBox Me.Button2 = New System.Windows.Forms.Button Me.Button1 = New System.Windows.Forms.Button Me.SuspendLayout() ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(16, 26) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(108, 23) Me.Label1.TabIndex = 0 Me.Label1.Text = "Template Directory" ' 'txtTemplateDir ' Me.txtTemplateDir.Location = New System.Drawing.Point(146, 28) Me.txtTemplateDir.Name = "txtTemplateDir" Me.txtTemplateDir.Size = New System.Drawing.Size(166, 20) Me.txtTemplateDir.TabIndex = 1 Me.txtTemplateDir.Text = "" ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(130, 126) Me.Button2.Name = "Button2" Me.Button2.TabIndex = 7 Me.Button2.Text = "Cancel" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(38, 126) Me.Button1.Name = "Button1" Me.Button1.TabIndex = 6 Me.Button1.Text = "OK" ' 'frmOptions ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(368, 158) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.txtTemplateDir) Me.Controls.Add(Me.Label1) Me.Name = "frmOptions" Me.Text = "Options" Me.ResumeLayout(False) End Sub #End Region Public o As COptions Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim d As Directory If d.Exists(txtTemplateDir.Text) Then o.TemplateDirectory = txtTemplateDir.Text o.Save() Me.Close() Else If MsgBox("Template directory does not exist. Do you wish to create it?", MsgBoxStyle.YesNo, "Create Template Directory") = MsgBoxResult.Yes Then d.CreateDirectory(txtTemplateDir.Text) o.TemplateDirectory = txtTemplateDir.Text o.Save() Me.Close() End If End If End Sub Private Sub frmOptions_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load txtTemplateDir.Text = o.TemplateDirectory End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub End Class --- NEW FILE: frmClasses.vb --- Imports WeifenLuo.WinFormsUI Public Class frmClasses Inherits WeifenLuo.WinFormsUI.DockContent #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents TreeView1 As System.Windows.Forms.TreeView Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu Friend WithEvents mnuNewClass As System.Windows.Forms.MenuItem Friend WithEvents mnuClassProperties As System.Windows.Forms.MenuItem Friend WithEvents ImageList1 As System.Windows.Forms.ImageList Friend WithEvents mnuDelete As System.Windows.Forms.MenuItem <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmClasses)) Me.TreeView1 = New System.Windows.Forms.TreeView Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) Me.ContextMenu1 = New System.Windows.Forms.ContextMenu Me.mnuNewClass = New System.Windows.Forms.MenuItem Me.mnuClassProperties = New System.Windows.Forms.MenuItem Me.mnuDelete = New System.Windows.Forms.MenuItem Me.SuspendLayout() ' 'TreeView1 ' Me.TreeView1.Dock = System.Windows.Forms.DockStyle.Fill Me.TreeView1.ImageList = Me.ImageList1 Me.TreeView1.Location = New System.Drawing.Point(0, 0) Me.TreeView1.Name = "TreeView1" Me.TreeView1.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Classes")}) Me.TreeView1.Size = New System.Drawing.Size(198, 266) Me.TreeView1.TabIndex = 0 ' 'ImageList1 ' Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer) Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent ' 'ContextMenu1 ' Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuNewClass, Me.mnuDelete, Me.mnuClassProperties}) ' 'mnuNewClass ' Me.mnuNewClass.Index = 0 Me.mnuNewClass.Text = "New" ' 'mnuClassProperties ' Me.mnuClassProperties.Index = 2 Me.mnuClassProperties.Text = "Properties" ' 'mnuDelete ' Me.mnuDelete.Index = 1 Me.mnuDelete.Text = "Delete" ' 'frmClasses ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(198, 266) Me.Controls.Add(Me.TreeView1) Me.DockableAreas = CType(((((WeifenLuo.WinFormsUI.DockAreas.Float Or WeifenLuo.WinFormsUI.DockAreas.DockLeft) _ Or WeifenLuo.WinFormsUI.DockAreas.DockRight) _ Or WeifenLuo.WinFormsUI.DockAreas.DockTop) _ Or WeifenLuo.WinFormsUI.DockAreas.DockBottom), WeifenLuo.WinFormsUI.DockAreas) Me.HideOnClose = True Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "frmClasses" Me.ShowHint = WeifenLuo.WinFormsUI.DockState.DockLeft Me.Text = "Classes" Me.ResumeLayout(False) End Sub #End Region Public frmMain As frmMain Public Sub ReloadTreeView() If frmMain Is Nothing Then Exit Sub End If Dim root As TreeNode TreeView1.BeginUpdate() TreeView1.Nodes.Clear() root = TreeView1.Nodes.Add("Classes") root.ImageIndex = 0 'loop to add databases Dim n As TreeNode For Each c As CMappedClass In frmMain.p.classes n = New TreeNode(c.ClassName) n.Tag = c root.ImageIndex = 0 If c.SuperClass Is Nothing Then root.Nodes.Add(n) Else Dim n1 As TreeNode = findNode(root, c.SuperClass.ClassName) If n1 Is Nothing Then root.Nodes.Add(n) Else n1.Nodes.Add(n) If c.SuperClass.Expanded Then n1.Expand() End If End If End If Next root.Expand() TreeView1.EndUpdate() End Sub Private Function findNode(ByVal root As TreeNode, ByVal name As String) As TreeNode For Each n As TreeNode In root.Nodes If n.Text = name Then Return n Else Dim n1 As TreeNode = findNode(n, name) If Not n1 Is Nothing Then Return n1 End If End If Next Return Nothing End Function Private Sub TreeView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.DoubleClick If TreeView1.SelectedNode Is Nothing Then Exit Sub End If ShowClass() End Sub Private Function FindDocument(ByVal cname As String) As DockContent For Each content As DockContent In DockPanel.Documents If content.Text = cname Then Return content End If Next Return Nothing End Function Private Sub TreeView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseUp If e.Button = MouseButtons.Right Then Dim n As TreeNode = Me.TreeView1.GetNodeAt(e.X, e.Y) If Not n Is Nothing Then Me.TreeView1.SelectedNode = n If n.Parent Is Nothing Then 'On the root node Me.mnuNewClass.Visible = True Me.mnuClassProperties.Visible = False Me.mnuDelete.Visible = False Else Me.mnuClassProperties.Text = "Properties" Me.mnuNewClass.Visible = True Me.mnuClassProperties.Visible = True Me.mnuDelete.Visible = True End If Else Me.mnuClassProperties.Text = "(no item selected)" Me.mnuNewClass.Visible = False Me.mnuClassProperties.Visible = True Me.mnuDelete.Visible = False End If Me.ContextMenu1.Show(Me.TreeView1, New Point(e.X, e.Y)) End If End Sub Private Sub mnuNewClass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuNewClass.Click Dim parentClass As CMappedClass If Not TreeView1.SelectedNode.Tag Is Nothing Then If TreeView1.SelectedNode.Tag.GetType Is GetType(CMappedClass) Then parentClass = TreeView1.SelectedNode.Tag End If End If Dim c As New CMappedClass If Not parentClass Is Nothing Then c.SuperClass = parentClass End If c.Project = frmMain.p frmMain.p.classes.Add(c) ReloadTreeView() Dim tn As TreeNode = findNode(TreeView1.Nodes(0), c.ClassName) tn.EnsureVisible() TreeView1.SelectedNode = tn ShowClass() End Sub Private Sub ShowClass() Dim cname As String cname = TreeView1.SelectedNode.Text If cname = "classes" Then Exit Sub End If Dim dc As DockContent = FindDocument(cname) If Not dc Is Nothing Then dc.Show(frmMain.DockPanel1) dc.Focus() Return End If Dim fc As frmClassInfo = New frmClassInfo fc.frmMain = frmMain fc.Text = cname fc.Show(frmMain.DockPanel1) End Sub Private Sub TreeView1_AfterExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterExpand If e.Node.Tag Is Nothing Then Exit Sub If e.Node.Tag.GetType Is GetType(CMappedClass) Then CType(e.Node.Tag, CMappedClass).Expanded = True End If End Sub Private Sub TreeView1_AfterCollapse(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterCollapse If e.Node.Tag Is Nothing Then Exit Sub If e.Node.Tag.GetType Is GetType(CMappedClass) Then CType(e.Node.Tag, CMappedClass).Expanded = False End If End Sub Private Sub mnuDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDelete.Click Dim cname As String cname = TreeView1.SelectedNode.Text If cname = "classes" Then Exit Sub End If RemoveClass(cname) End Sub Private Sub RemoveClass(ByVal cname As String) Dim cls As CMappedClass Dim classesToRemove As New Collection For Each cls In frmMain.p.classes If Not cls.SuperClass Is Nothing Then If cls.SuperClass.ClassName = cname Then classesToRemove.Add(cls) End If End If Next For Each cls In classesToRemove RemoveClass(cls.ClassName) Next Dim dc As DockContent = FindDocument(cname) If Not dc Is Nothing Then 'Close the class window dc.Close() End If cls = frmMain.p.classes(cname) frmMain.p.classes.Remove(cls) Dim tn As TreeNode = findNode(TreeView1.Nodes(0), cname) TreeView1.Nodes.Remove(tn) End Sub Private Sub mnuClassProperties_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuClassProperties.Click ShowClass() End Sub Private Sub TreeView1_ItemDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles TreeView1.ItemDrag If e.Button = MouseButtons.Left Then DoDragDrop(e.Item, DragDropEffects.Copy) End If End Sub End Class --- NEW FILE: FrameworkMapper.vbproj --- <VisualStudioProject> <VisualBasic ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{F656650C-9484-4E0F-AC0B-0358E133FB96}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "FrameworkMapper" AssemblyOriginatorKeyFile = "" AssemblyOriginatorKeyMode = "None" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "WinExe" OptionCompare = "Binary" OptionExplicit = "On" OptionStrict = "Off" RootNamespace = "FrameworkMapper" StartupObject = "FrameworkMapper.FrmMain" > <Config Name = "Debug" BaseAddress = "285212672" ConfigurationOverrideFile = "" DefineConstants = "" DefineDebug = "true" DefineTrace = "true" DebugSymbols = "true" IncrementalBuild = "true" Optimize = "false" OutputPath = "bin\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "1" /> <Config Name = "Release" BaseAddress = "285212672" ConfigurationOverrideFile = "" DefineConstants = "" DefineDebug = "false" DefineTrace = "true" DebugSymbols = "false" IncrementalBuild = "false" Optimize = "true" OutputPath = "bin\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "1" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" /> <Reference Name = "System.Data" AssemblyName = "System.Data" /> <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" /> <Reference Name = "System.Windows.Forms" AssemblyName = "System.Windows.Forms" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" /> <Reference Name = "Microsoft.VisualBasic" AssemblyName = "Microsoft.VisualBasic" HintPath = "..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Microsoft.VisualBasic.dll" /> <Reference Name = "WeifenLuo.WinFormsUI" AssemblyName = "WeifenLuo.WinFormsUI" HintPath = "WinFormsUI\bin\Debug\WeifenLuo.WinFormsUI.dll" /> </References> <Imports> <Import Namespace = "Microsoft.VisualBasic" /> <Import Namespace = "System" /> <Import Namespace = "System.Collections" /> <Import Namespace = "System.Data" /> <Import Namespace = "System.Drawing" /> <Import Namespace = "System.Diagnostics" /> <Import Namespace = "System.Windows.Forms" /> </Imports> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CAssociationEntry.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CAssociationEntryCollection.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CAttributeList.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedAssociation.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedAttribute.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedAttributeCollection.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedClass.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedClassCollection.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CMappedDatabase.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "COptions.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CProject.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "frmAddDatabase.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "frmAddDatabase.resx" DependentUpon = "frmAddDatabase.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmClasses.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "frmClasses.resx" DependentUpon = "frmClasses.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmClassInfo.vb" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "frmClassInfo.resx" ... [truncated message content] |
From: Richard B. <rb...@us...> - 2004-10-12 23:09:29
|
Update of /cvsroot/jcframework/FrameworkMapper/Images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv442/Images Log Message: Directory /cvsroot/jcframework/FrameworkMapper/Images added to the repository |
From: Dan M. <dan...@us...> - 2004-10-12 09:00:00
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7362/dotnet Modified Files: AFExceptions.vb Log Message: Add the Inner exception message to the exception's message. Index: AFExceptions.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/AFExceptions.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AFExceptions.vb 27 Jun 2004 22:57:54 -0000 1.1 +++ AFExceptions.vb 12 Oct 2004 08:57:52 -0000 1.2 @@ -8,7 +8,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -20,7 +20,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -32,7 +32,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -44,7 +44,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -56,7 +56,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -68,7 +68,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -80,7 +80,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -92,7 +92,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -104,7 +104,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -116,7 +116,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -128,7 +128,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -140,7 +140,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -152,7 +152,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -164,7 +164,7 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class @@ -176,6 +176,6 @@ MyBase.New(Message) End Sub Public Sub New(ByVal Message As String, ByVal Inner As Exception) - MyBase.New(Message) + MyBase.New(Message & Environment.NewLine & "Inner Exception message : " & Inner.Message) End Sub End Class \ No newline at end of file |
From: Richard B. <rb...@us...> - 2004-10-11 23:05:01
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26300 Modified Files: CMsSqlDatabase.vb Log Message: Added SSPI login ability for MSSQLServer Index: CMsSqlDatabase.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CMsSqlDatabase.vb,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** CMsSqlDatabase.vb 28 Sep 2004 07:30:32 -0000 1.17 --- CMsSqlDatabase.vb 11 Oct 2004 23:03:38 -0000 1.18 *************** *** 51,62 **** pbroker.GetLoginDetails(Me, m_user, m_password) End If ! conn.Connection.ConnectionString = _ ! "Data Source=" & m_serverName & ";" & _ ! "Initial Catalog=" & m_name & ";" & _ ! "Integrated Security=false;" & _ ! "Persist Security Info=False;" & _ ! "User Id=" & m_user & ";" & _ ! "Password=" & m_password ! conn.Connection.Open() Catch ex As SqlClient.SqlException Throw New DatabaseConnectionException(ex.Message, ex) --- 51,70 ---- pbroker.GetLoginDetails(Me, m_user, m_password) End If ! If m_user = "SSPI" Then ! conn.Connection.ConnectionString = _ ! "Data Source=" & m_serverName & ";" & _ ! "Initial Catalog=" & m_name & ";" & _ ! "Integrated Security=SSPI;" & _ ! "Persist Security Info=False;" ! Else ! conn.Connection.ConnectionString = _ ! "Data Source=" & m_serverName & ";" & _ ! "Initial Catalog=" & m_name & ";" & _ ! "Integrated Security=false;" & _ ! "Persist Security Info=False;" & _ ! "User Id=" & m_user & ";" & _ ! "Password=" & m_password ! conn.Connection.Open() ! End If Catch ex As SqlClient.SqlException Throw New DatabaseConnectionException(ex.Message, ex) |
From: Richard B. <rb...@us...> - 2004-10-11 22:51:29
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23200 Modified Files: CPersistentObject.vb Log Message: Some changes to getAll and new method for deleteAll. Code contributed by Marcos De Oliviera (mfo) Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** CPersistentObject.vb 28 Sep 2004 04:19:04 -0000 1.38 --- CPersistentObject.vb 11 Oct 2004 22:50:56 -0000 1.39 *************** *** 956,959 **** --- 956,983 ---- End Sub + ''' ----------------------------------------------------------------------------- + ''' <summary> + ''' Remove all objects for a class. + ''' </summary> + ''' <remarks></remarks> + ''' <history> + ''' [mfo] 27/09/2004 Created + ''' </history> + ''' ----------------------------------------------------------------------------- + Public Overridable Sub deleteAll() + Dim obj As CPersistentObject + Dim obRC As CRetrieveCriteria + Dim obCursor As CCursor + + obRC = New CRetrieveCriteria + obCursor = obRC.perform(Me) + Do While Not obCursor.EOF + obj = Me.getNewObject + obCursor.loadProxy(obj) + obj.Delete() + obCursor.nextCursor() + Loop + End Sub + '''----------------------------------------------------------------------------- ''' <summary> *************** *** 1303,1306 **** --- 1327,1331 ---- obRC = New AToMSFramework.CRetrieveCriteria obRC.ClassMap = Me.getClassMap + obRC.ReturnFullObjects = True ' If the collection isn't nothing. *************** *** 1320,1324 **** End If - obCursor.HoldsProxies = False obCursor = obRC.perform(Me) obCol = New CPersistentCollection --- 1345,1348 ---- *************** *** 1348,1366 **** '''----------------------------------------------------------------------------- Public Function getCollectionByAttributesWithEqualTo(ByVal colAttributes As Collection) As CPersistentCollection Dim obAux As Object Dim obCol As CPersistentCollection Dim obRC As New CRetrieveCriteria Dim obCursor As CCursor - Dim obCC As New CCriteriaCondition Dim stAttribute As String obRC.ClassMap = Me.getClassMap(Me) - obCC.ClassMap = Me.getClassMap(Me) For Each stAttribute In colAttributes ! obCC.addSelectEqualTo(stAttribute, Me.getValueByAttribute(stAttribute)) Next ! obRC.WhereCondition = obCC obCursor = obRC.perform(Me) obCursor.HoldsProxies = False --- 1372,1428 ---- '''----------------------------------------------------------------------------- Public Function getCollectionByAttributesWithEqualTo(ByVal colAttributes As Collection) As CPersistentCollection + Return getCollectionByAttributesWithEqualTo(colAttributes, Nothing, Nothing) + End Function + + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Gets all objects for a class that match an number of attribute values. + ''' </summary> + ''' <param name="colAttributes">A collection of attributes names</param> + ''' <param name="pOrderCol">Collection of attributes (strings) to order by.</param> + ''' <param name="pOrderAscCol">Collection of boolean flags to indicate sort order (true = ascending).</param> + ''' <returns>A CPersistentCollection containing the matching objects.</returns> + ''' <remarks>The object that the method is called against must have the + ''' values of the named attributes set. These values are used to build a + ''' retrieveCriteria object. + ''' <para>The retrieveCriteria is then performed and the resulting objects + ''' instantiated and added to the CPersistentCollection.</para></remarks> + ''' <history> + ''' [Marcos Flavio de Oliviera - mf...@cd...] 18/12/2003 Created + ''' [Marcos Flavio de Oliviera - mf...@cd...] 01/10/2004 Include ordering. + ''' </history> + '''----------------------------------------------------------------------------- + Public Function getCollectionByAttributesWithEqualTo(ByVal colAttributes As Collection, ByVal pOrderCol As Collection, ByVal pOrderAscCol As Collection) As CPersistentCollection Dim obAux As Object Dim obCol As CPersistentCollection Dim obRC As New CRetrieveCriteria Dim obCursor As CCursor Dim stAttribute As String + Dim inIndex As Integer + Dim boAscend As Boolean obRC.ClassMap = Me.getClassMap(Me) For Each stAttribute In colAttributes ! obRC.WhereCondition.addSelectEqualTo(stAttribute, Me.getValueByAttribute(stAttribute)) Next ! ' If the collection isn't nothing. ! If Not IsNothing(pOrderCol) Then ! ' For each attribute in collection, add a order attribute in retrieve criteria. ! For inIndex = 1 To pOrderCol.Count ! boAscend = True ! If Not IsNothing(pOrderAscCol) Then ! If inIndex <= pOrderAscCol.Count Then ! ' If the item for ascend is false. ! If TypeOf (pOrderAscCol(inIndex)) Is Boolean Then ! boAscend = pOrderAscCol(inIndex) ! End If ! End If ! End If ! obRC.addOrderAttributeByAscend(pOrderCol(inIndex), boAscend) ! Next ! End If ! obCursor = obRC.perform(Me) obCursor.HoldsProxies = False |
From: Richard B. <rb...@us...> - 2004-10-08 00:10:08
|
Update of /cvsroot/jcframework/Nunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10040 Modified Files: AtomsFrameworkTests.vb Log Message: Added test for CDeleteCriteria Index: AtomsFrameworkTests.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/AtomsFrameworkTests.vb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AtomsFrameworkTests.vb 28 Sep 2004 07:32:24 -0000 1.3 --- AtomsFrameworkTests.vb 8 Oct 2004 00:09:58 -0000 1.4 *************** *** 57,60 **** --- 57,112 ---- End Sub + <Test()> Public Sub ChangeFindFieldValue() + Dim oidvalue As String + emp.Name = "SaveThenChange" + emp.Find() + Assert.IsFalse(emp.Persistent) + oidvalue = emp.OIDValue + emp.Save() + Assert.IsTrue(emp.Persistent) + Assert.IsTrue(emp.ReportsTo Is Nothing) + Assert.IsFalse(emp.IsReferenced) + emp = New CEmployee + emp.Name = "SaveThenChange" + emp.Find() + Assert.IsTrue(emp.Persistent) + Assert.AreEqual(emp.OIDValue, oidvalue) + Assert.AreEqual(emp.Name, "SaveThenChange") + emp.Name = "Changed" + emp.Save() + Assert.IsTrue(emp.Persistent) + emp.Delete() + Assert.IsFalse(emp.Persistent) + emp = New CEmployee + emp.Name = "Changed" + emp.Find() + Assert.IsFalse(emp.Persistent) + emp = New CEmployee + emp.Name = "SaveThenChange" + emp.Find() + Assert.IsFalse(emp.Persistent) + End Sub + + <Test()> Public Sub DeleteMultipleEmployees() + emp.Name = "DeleteMe1" + emp.Save() + emp = New CEmployee + emp.Name = "DeleteMe2" + emp.Save() + emp = New CEmployee + emp.Name = "DeleteMe3" + emp.Save() + Dim dc As CDeleteCriteria + dc = New CDeleteCriteria + dc.ClassMap = emp.getClassMap + dc.WhereCondition.addSelectlike("Name", "DeleteMe%") + Dim i As Integer = dc.perform() + Assert.AreEqual(i, 3) + emp = New CEmployee + emp.Name = "DeleteMe1" + emp.Find() + Assert.IsFalse(emp.Persistent) + End Sub + <Test()> Public Sub LoadEmployee_ac() emp.Name = "ac" |
From: Richard B. <rb...@us...> - 2004-10-08 00:06:39
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9213 Modified Files: CCriteriaCondition.vb CDeleteCriteria.vb CPersistenceBroker.vb Log Message: Fixed problem in CDeleteCriteria Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** CPersistenceBroker.vb 7 Oct 2004 05:57:33 -0000 1.61 --- CPersistenceBroker.vb 8 Oct 2004 00:06:25 -0000 1.62 *************** *** 1120,1129 **** 'Creamos un RetrieveCriteria para obtener el objeto a eliminar ! Dim retrieveCriteria As CRetrieveCriteria ! retrieveCriteria = New CRetrieveCriteria ! retrieveCriteria.Criteria = pCriteria.Criteria ! ! Dim statement As CSqlStatement ! 'Set statement = retrieveCriteria.getSqlStatement conn.startTransaction() --- 1120,1126 ---- 'Creamos un RetrieveCriteria para obtener el objeto a eliminar ! Dim retrieveCriteria As New CRetrieveCriteria ! retrieveCriteria.ClassMap = pCriteria.ClassMap ! retrieveCriteria.WhereCondition = pCriteria.WhereCondition conn.startTransaction() *************** *** 1138,1144 **** --- 1135,1143 ---- Try Do While cursor.hasElements And Not cursor.EOF + persObj = pCriteria.ClassMap.CreateObjectInstance cursor.loadProxy(persObj) deletePrivateObject(persObj, conn, False) contador = contador + 1 + cursor.nextCursor() Loop conn.commit() Index: CCriteriaCondition.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CCriteriaCondition.vb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CCriteriaCondition.vb 27 Sep 2004 02:39:31 -0000 1.14 --- CCriteriaCondition.vb 8 Oct 2004 00:06:25 -0000 1.15 *************** *** 615,622 **** End Function ! Public Function addSelectlike(ByVal Name As String, ByVal ValueA As Object) As CSelectionCriteria Return addSelectlike(Name, ValueA, "", False) End Function ! Public Function addSelectlike(ByVal Name As String, ByVal ValueA As Object, ByVal useOr As Boolean) As CSelectionCriteria Return addSelectlike(Name, ValueA, "", useOr) End Function --- 615,622 ---- End Function ! Public Function addSelectLike(ByVal Name As String, ByVal ValueA As Object) As CSelectionCriteria Return addSelectlike(Name, ValueA, "", False) End Function ! Public Function addSelectLike(ByVal Name As String, ByVal ValueA As Object, ByVal useOr As Boolean) As CSelectionCriteria Return addSelectlike(Name, ValueA, "", useOr) End Function *************** *** 636,640 **** ''' </history> '''----------------------------------------------------------------------------- ! Public Function addSelectlike(ByVal Name As String, ByVal ValueA As Object, ByVal tblAlias As String, ByVal useOr As Boolean) As CSelectionCriteria Dim selCri As New CLikeCriteria selCri.AddUsingOr = useOr --- 636,640 ---- ''' </history> '''----------------------------------------------------------------------------- ! Public Function addSelectLike(ByVal Name As String, ByVal ValueA As Object, ByVal tblAlias As String, ByVal useOr As Boolean) As CSelectionCriteria Dim selCri As New CLikeCriteria selCri.AddUsingOr = useOr Index: CDeleteCriteria.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CDeleteCriteria.vb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CDeleteCriteria.vb 21 Jul 2004 02:55:38 -0000 1.5 --- CDeleteCriteria.vb 8 Oct 2004 00:06:25 -0000 1.6 *************** *** 34,41 **** ''' </history> '''----------------------------------------------------------------------------- ! Public Function perform() As CCursor Static persistentBroker As CPersistenceBroker persistentBroker = getPersistenceBrokerInstance() ! persistentBroker.Instance.processDeleteCriteria(Me) End Function --- 34,41 ---- ''' </history> '''----------------------------------------------------------------------------- ! Public Function perform() As Integer Static persistentBroker As CPersistenceBroker persistentBroker = getPersistenceBrokerInstance() ! Return persistentBroker.Instance.processDeleteCriteria(Me) End Function |
From: Richard B. <rb...@us...> - 2004-10-07 23:15:24
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30810 Modified Files: CMultiRetrieveCriteria.vb COrderEntry.vb Log Message: Allow order by on MultiRetrieveCriteria to work using attributes of associated classes. Index: COrderEntry.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/COrderEntry.vb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** COrderEntry.vb 21 Jul 2004 02:55:38 -0000 1.4 --- COrderEntry.vb 7 Oct 2004 23:15:14 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- Private m_attributeMap As CAttributeMap Private m_ascend As Boolean + Private m_ClassMap As CClassMap '''----------------------------------------------------------------------------- *************** *** 39,43 **** Public Property Ascend() As Boolean Get ! Ascend = m_ascend End Get Set(ByVal Value As Boolean) --- 40,44 ---- Public Property Ascend() As Boolean Get ! Return m_ascend End Get Set(ByVal Value As Boolean) *************** *** 58,62 **** Public Property AttributeMap() As CAttributeMap Get ! AttributeMap = m_attributeMap End Get Set(ByVal Value As CAttributeMap) --- 59,63 ---- Public Property AttributeMap() As CAttributeMap Get ! Return m_attributeMap End Get Set(ByVal Value As CAttributeMap) *************** *** 67,70 **** --- 68,89 ---- '''----------------------------------------------------------------------------- ''' <summary> + ''' The CClassMap the attribute belongs to + ''' </summary> + ''' <value>An Class Map for the table</value> + ''' <remarks></remarks> + ''' <history> + ''' [exelrud] 10/07/2004 Created + ''' </history> + '''----------------------------------------------------------------------------- + Public Property ClassMap() As CClassMap + Get + Return m_ClassMap + End Get + Set(ByVal Value As CClassMap) + m_ClassMap = Value + End Set + End Property + '''----------------------------------------------------------------------------- + ''' <summary> ''' Creates a new instance of the COrderEntry class. ''' </summary> Index: CMultiRetrieveCriteria.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CMultiRetrieveCriteria.vb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CMultiRetrieveCriteria.vb 21 Jul 2004 02:55:38 -0000 1.13 --- CMultiRetrieveCriteria.vb 7 Oct 2004 23:15:10 -0000 1.14 *************** *** 256,260 **** Dim orderEntry As COrderEntry orderEntry = New COrderEntry ! orderEntry.AttributeMap = ClassMap.getAttributeMapByString(attributeName, True) orderEntry.Ascend = pAscend m_orderAttributes.Add(orderEntry) --- 256,278 ---- Dim orderEntry As COrderEntry orderEntry = New COrderEntry ! ! If attributeName.IndexOf(".") >= 0 Then ! Dim Parts() As String ! Parts = attributeName.Split(".") ! ! attributeName = Parts(1) ! ! Dim cm As CClassMap ! For Each cm In m_fromCMaps ! If cm.Name.Equals(Parts(0)) Then ! orderEntry.ClassMap = cm ! orderEntry.AttributeMap = cm.getAttributeMapByString(attributeName, True) ! Exit For ! End If ! Next ! Else ! orderEntry.ClassMap = ClassMap ! orderEntry.AttributeMap = ClassMap.getAttributeMapByString(attributeName, True) ! End If orderEntry.Ascend = pAscend m_orderAttributes.Add(orderEntry) *************** *** 318,321 **** --- 336,340 ---- Dim isFirst As Boolean = True Dim mapName As String + Dim ht As New Hashtable statement.addSqlClause(Me.ClassMap.RelationalDatabase.getClauseStringSelect) *************** *** 332,335 **** --- 351,355 ---- j += 1 mapName = "t" & j.ToString + ht.Add(cm.Name, mapName) 'Load each individual column, and process in order of objects to join For i = 1 To cm.getSize *************** *** 374,378 **** statement.addSqlClause(" ") End If ! statement.addSqlClause(entry.AttributeMap.ColumnMap.getAliasQualifiedName("t1")) If entry.Ascend Then statement.addSqlClause(" " & Me.ClassMap.RelationalDatabase.getClauseStringAscend) --- 394,399 ---- statement.addSqlClause(" ") End If ! statement.addSqlClause(entry.AttributeMap.ColumnMap.getAliasQualifiedName(ht(entry.ClassMap.Name))) ! 'statement.addSqlClause(entry.AttributeMap.ColumnMap.getAliasQualifiedName("t1")) If entry.Ascend Then statement.addSqlClause(" " & Me.ClassMap.RelationalDatabase.getClauseStringAscend) |
From: Richard B. <rb...@us...> - 2004-10-07 05:58:32
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20010 Modified Files: CColumnMap.vb CPersistenceBroker.vb CSqlStatement.vb CXMLConfigLoader.vb Log Message: Handle value conversions when using string.empty with columns marked as NOT NULL Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** CPersistenceBroker.vb 6 Oct 2004 23:42:24 -0000 1.60 --- CPersistenceBroker.vb 7 Oct 2004 05:57:33 -0000 1.61 *************** *** 1762,1769 **** If Not dt Is Nothing Then For Each myfield In dt.Rows ! Debug.WriteLine(myfield("ColumnName") & " size = " & myfield("ColumnSize").ToString & "; type = " & myfield("DataType").ToString & "; providertype = " & myfield("ProviderType").ToString) cc.Add(myfield("ColumnSize"), myfield("ColumnName")) cc.Add(myfield("DataType"), myfield("ColumnName") & "DT") cc.Add(myfield("ProviderType"), myfield("ColumnName") & "PT") Next End If --- 1762,1774 ---- If Not dt Is Nothing Then For Each myfield In dt.Rows ! If myfield("AllowDBNull") Then ! Debug.WriteLine(myfield("ColumnName") & " (Null) size = " & myfield("ColumnSize").ToString & " type = " & myfield("DataType").ToString & " providertype = " & myfield("ProviderType").ToString) ! Else ! Debug.WriteLine(myfield("ColumnName") & " (Not Null) size = " & myfield("ColumnSize").ToString & " type = " & myfield("DataType").ToString & " providertype = " & myfield("ProviderType").ToString) ! End If cc.Add(myfield("ColumnSize"), myfield("ColumnName")) cc.Add(myfield("DataType"), myfield("ColumnName") & "DT") cc.Add(myfield("ProviderType"), myfield("ColumnName") & "PT") + cc.Add(myfield("AllowDBNull"), myfield("ColumnName") & "NL") Next End If *************** *** 1792,1795 **** --- 1797,1801 ---- AttrMap.ColumnMap.StorageType = cc.Item(AttrMap.ColumnMap.Name & "DT") AttrMap.ColumnMap.ProviderType = cc.Item(AttrMap.ColumnMap.Name & "PT") + AttrMap.ColumnMap.IsNullable = cc.Item(AttrMap.ColumnMap.Name & "NL") Catch Throw New NoColumnException("Error retrieving storage information for column " _ *************** *** 1829,1832 **** --- 1835,1839 ---- AttrMap.ColumnMap.StorageType = cc.Item(AttrMap.ColumnMap.Name & "DT") AttrMap.ColumnMap.ProviderType = cc.Item(AttrMap.ColumnMap.Name & "PT") + AttrMap.ColumnMap.IsNullable = cc.Item(AttrMap.ColumnMap.Name & "NL") Catch Throw New NoColumnException("Error retrieving storage information for column " _ *************** *** 1886,1889 **** --- 1893,1897 ---- colMap.StorageType = cc.Item(ClassMap.SharedTableField & "DT") colMap.ProviderType = cc.Item(ClassMap.SharedTableField & "PT") + colMap.IsNullable = cc.Item(ClassMap.SharedTableField & "NL") Catch Throw New NoColumnException("Error retrieving storage information for column " _ Index: CColumnMap.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CColumnMap.vb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CColumnMap.vb 21 Jul 2004 02:55:38 -0000 1.9 --- CColumnMap.vb 7 Oct 2004 05:57:33 -0000 1.10 *************** *** 64,67 **** --- 64,68 ---- Private m_columnType As Type Private m_providerType As Integer + Private m_isNullable As Boolean '''----------------------------------------------------------------------------- *************** *** 223,226 **** --- 224,236 ---- End Property + Public Property IsNullable() As Boolean + Get + Return m_isNullable + End Get + Set(ByVal Value As Boolean) + m_isNullable = Value + End Set + End Property + Public Sub New() MyBase.New() *************** *** 228,231 **** --- 238,242 ---- m_isFindColumn = False m_isIdentityColumn = False + m_isNullable = True End Sub Index: CSqlStatement.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CSqlStatement.vb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CSqlStatement.vb 1 Sep 2004 04:21:12 -0000 1.9 --- CSqlStatement.vb 7 Oct 2004 05:57:33 -0000 1.10 *************** *** 125,144 **** sp.Value = obj ! If IsNullAlias(obj) Then ! sp.Value = DBNull.Value ! Else ! If TypeOf (obj) Is Date Or TypeOf (obj) Is DateTime Then ! dd = CType(obj, DateTime) ! If dd = Date.MinValue Then ! sp.Value = DBNull.Value ! End If ! End If ! End If ! If sp.Value Is DBNull.Value Then ! Debug.WriteLine(sp.Name & ": NULL") ! Else ! Debug.WriteLine(sp.Name & ": " & sp.Value.ToString) ! End If ! m_paramValues.Add(sp) End Sub End Class --- 125,155 ---- sp.Value = obj ! If c.IsNullable Then ! If IsNullAlias(obj) Then ! sp.Value = DBNull.Value ! Else ! If TypeOf (obj) Is Date Or TypeOf (obj) Is DateTime Then ! dd = CType(obj, DateTime) ! If dd = Date.MinValue Then ! sp.Value = DBNull.Value ! End If ! End If ! End If ! End If ! If sp.Value Is DBNull.Value Then ! Debug.WriteLine(sp.Name & ": NULL") ! Else ! If sp.Value Is Nothing Then ! If c.StorageType Is GetType(String) Then ! sp.Value = String.Empty ! ElseIf c.StorageType Is GetType(Integer) Then ! sp.Value = 0 ! Else ! Throw New AttributeValueException("Tried to pass nothing to a column that does not allow NULLs") ! End If ! End If ! Debug.WriteLine(sp.Name & ": " & sp.Value.ToString) ! End If ! m_paramValues.Add(sp) End Sub End Class Index: CXMLConfigLoader.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CXMLConfigLoader.vb,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** CXMLConfigLoader.vb 28 Sep 2004 04:19:04 -0000 1.22 --- CXMLConfigLoader.vb 7 Oct 2004 05:57:33 -0000 1.23 *************** *** 367,374 **** For Each myfield In dt.Rows 'For each field in the table get the column info for later use ! Debug.WriteLine(myfield("ColumnName") & " size = " & myfield("ColumnSize").ToString & " type = " & myfield("DataType").ToString & " providertype = " & myfield("ProviderType").ToString) cc.Add(myfield("ColumnSize"), myfield("ColumnName")) cc.Add(myfield("DataType"), myfield("ColumnName") & "DT") cc.Add(myfield("ProviderType"), myfield("ColumnName") & "PT") Next End If --- 367,379 ---- For Each myfield In dt.Rows 'For each field in the table get the column info for later use ! If myfield("AllowDBNull") Then ! Debug.WriteLine(myfield("ColumnName") & " (Null) size = " & myfield("ColumnSize").ToString & " type = " & myfield("DataType").ToString & " providertype = " & myfield("ProviderType").ToString) ! Else ! Debug.WriteLine(myfield("ColumnName") & " (Not Null) size = " & myfield("ColumnSize").ToString & " type = " & myfield("DataType").ToString & " providertype = " & myfield("ProviderType").ToString) ! End If cc.Add(myfield("ColumnSize"), myfield("ColumnName")) cc.Add(myfield("DataType"), myfield("ColumnName") & "DT") cc.Add(myfield("ProviderType"), myfield("ColumnName") & "PT") + cc.Add(myfield("AllowDBNull"), myfield("ColumnName") & "NL") Next End If *************** *** 376,384 **** If Not ClassMap.SharedTableField Is Nothing Then 'Create a column map for the sharedtablefield ! Dim colMap = New CColumnMap Try colMap.StorageSize = cc.Item(ClassMap.SharedTableField) colMap.StorageType = cc.Item(ClassMap.SharedTableField & "DT") colMap.ProviderType = cc.Item(ClassMap.SharedTableField & "PT") Catch Throw New NoColumnException("Error retrieving storage information for column " _ --- 381,390 ---- If Not ClassMap.SharedTableField Is Nothing Then 'Create a column map for the sharedtablefield ! Dim colMap As CColumnMap = New CColumnMap Try colMap.StorageSize = cc.Item(ClassMap.SharedTableField) colMap.StorageType = cc.Item(ClassMap.SharedTableField & "DT") colMap.ProviderType = cc.Item(ClassMap.SharedTableField & "PT") + colMap.IsNullable = cc.Item(ClassMap.SharedTableField & "NL") Catch Throw New NoColumnException("Error retrieving storage information for column " _ *************** *** 401,404 **** --- 407,411 ---- AttrMap.ColumnMap.StorageType = cc.Item(AttrMap.ColumnMap.Name & "DT") AttrMap.ColumnMap.ProviderType = cc.Item(AttrMap.ColumnMap.Name & "PT") + AttrMap.ColumnMap.IsNullable = cc.Item(AttrMap.ColumnMap.Name & "NL") Catch Throw New XMLMappingException("Error retrieving database information for column " _ |
From: Richard B. <rb...@us...> - 2004-10-06 23:42:45
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18377 Modified Files: CClassMap.vb CConnection.vb CPersistenceBroker.vb Log Message: Changed basic SQL statements (SELECT,UPDATE,INSERT,DELETE) to only use parameters for where clauses. Should increase SQL server's ability to cache statements and thus result in improved speed. Index: CConnection.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CConnection.vb,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** CConnection.vb 28 Sep 2004 07:30:16 -0000 1.25 --- CConnection.vb 6 Oct 2004 23:42:24 -0000 1.26 *************** *** 444,453 **** SyncLock GetType(COleDBConnection) Dim x As RetrieveException If DEBUG_MODE Then Debug.WriteLine(statement.SqlString) End If ! Dim rs As New CResultset Try ! Dim m_adapter As New OleDbDataAdapter(statement.SqlString, m_connection) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") --- 444,468 ---- SyncLock GetType(COleDBConnection) Dim x As RetrieveException + Dim rs As New CResultset + Dim param As OleDbParameter + Dim dd As Date + Dim m_command As New OleDbCommand + If DEBUG_MODE Then Debug.WriteLine(statement.SqlString) End If ! ! m_command.Connection = m_connection ! m_command.CommandText = statement.SqlString ! For Each cp As CSQLParameter In statement.Parameters ! param = New OleDbParameter ! param.ParameterName = cp.Name ! param.OleDbType = CType(cp.Column.ProviderType, OleDbType) ! param.Value = cp.Value ! m_command.Parameters.Add(param) ! Next ! Try ! Dim m_adapter As New OleDbDataAdapter(m_command) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") *************** *** 895,903 **** Dim x As RetrieveException Dim rs As New CResultset If DEBUG_MODE Then System.Diagnostics.Debug.WriteLine(statement.SqlString) End If Try ! Dim m_adapter As New SqlDataAdapter(statement.SqlString, m_connection) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") --- 910,942 ---- Dim x As RetrieveException Dim rs As New CResultset + Dim param As SqlParameter + Dim dd As Date + Dim m_command As New SqlCommand + If DEBUG_MODE Then System.Diagnostics.Debug.WriteLine(statement.SqlString) End If + + m_command.Connection = m_connection + m_command.CommandText = statement.SqlString + For Each cp As CSQLParameter In statement.Parameters + param = New SqlParameter + param.ParameterName = cp.Name + param.SqlDbType = CType(cp.Column.ProviderType, SqlDbType) + If TypeOf (cp.Value) Is DateTime Then + dd = cp.Value + If dd.Ticks = 0 Then + dd = DateAdd(DateInterval.Year, 1899, dd) + Else + dd = New Date(dd.Year, dd.Month, dd.Day, dd.Hour, dd.Minute, dd.Second, 0) + End If + cp.Value = dd + End If + param.Value = cp.Value + m_command.Parameters.Add(param) + Next + Try ! Dim m_adapter As New SqlDataAdapter(m_command) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") *************** *** 1365,1373 **** Dim x As RetrieveException Dim rs As New CResultset If DEBUG_MODE Then System.Diagnostics.Debug.WriteLine(statement.SqlString) End If Try ! Dim m_adapter As New MySqlDataAdapter(statement.SqlString, m_connection) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") --- 1404,1427 ---- Dim x As RetrieveException Dim rs As New CResultset + Dim m_command As New MySqlCommand + Dim cp As CSQLParameter + Dim param As MySqlParameter + If DEBUG_MODE Then System.Diagnostics.Debug.WriteLine(statement.SqlString) End If + + m_command.Connection = m_connection + m_command.CommandText = statement.SqlString + For Each cp In statement.Parameters + param = New MySqlParameter + param.ParameterName = cp.Name + param.MySqlDbType = CType(cp.Column.ProviderType, MySqlDbType) + param.Value = cp.Value + m_command.Parameters.Add(param) + Next + Try ! Dim m_adapter As New MySqlDataAdapter(m_command) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") *************** *** 1770,1779 **** SyncLock GetType(CODBCConnection) Dim x As RetrieveException If DEBUG_MODE Then Debug.WriteLine(statement.SqlString) End If ! Dim rs As New CResultset Try ! Dim m_adapter As New OdbcDataAdapter(statement.SqlString, m_connection) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") --- 1824,1847 ---- SyncLock GetType(CODBCConnection) Dim x As RetrieveException + Dim rs As New CResultset + Dim m_command As New OdbcCommand + Dim param As OdbcParameter + If DEBUG_MODE Then Debug.WriteLine(statement.SqlString) End If ! ! m_command.Connection = m_connection ! m_command.CommandText = statement.SqlString ! For Each cp As CSQLParameter In statement.Parameters ! param = New OdbcParameter ! param.ParameterName = cp.Name ! param.OdbcType = CType(cp.Column.ProviderType, System.Data.odbc.OdbcType) ! param.Value = cp.Value ! m_command.Parameters.Add(param) ! Next ! Try ! Dim m_adapter As New OdbcDataAdapter(m_command) If m_transactioncalls > 0 Then m_adapter.SelectCommand.Transaction = m_transaction m_adapter.Fill(rs.ResultSet, "ole") Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** CPersistenceBroker.vb 6 Oct 2004 07:44:28 -0000 1.59 --- CPersistenceBroker.vb 6 Oct 2004 23:42:24 -0000 1.60 *************** *** 298,302 **** obj.IsLoading = True ! Dim al As New ArrayList cm2 = cm Do --- 298,331 ---- obj.IsLoading = True ! 'Dim al As New ArrayList ! 'cm2 = cm ! 'Do ! ' If useFind Then ! ' For i = 1 To cm2.getFindSize ! ' am = cm2.FindAttributeMaps(i) ! ' al.Add(cm2.RelationalDatabase.getValueFor(obj.getValueByAttribute(am.Name))) ! ' Next i ! ' cm2 = cm2.SuperClass ! ' Else ! ' For i = 1 To cm2.getKeySize ! ' am = cm2.getKeyAttributeMap(i) ! ' al.Add(cm2.RelationalDatabase.getValueFor(obj.getValueByAttribute(am.Name))) ! ' Next i ! ' cm2 = Nothing ! ' End If ! 'Loop While Not cm2 Is Nothing ! 'Dim statement As CSqlStatement ! 'If useFind Then ! ' statement = cm.getSQLFind(Me, al) ! 'Else ! ' statement = cm.getSQLRetrieve(Me, al) ! 'End If ! ! Dim statement As CSqlStatement ! If useFind Then ! statement = cm.getSQLFind(Me, Nothing) ! Else ! statement = cm.getSQLRetrieve(Me, Nothing) ! End If cm2 = cm Do *************** *** 304,308 **** For i = 1 To cm2.getFindSize am = cm2.FindAttributeMaps(i) ! al.Add(cm2.RelationalDatabase.getValueFor(obj.getValueByAttribute(am.Name))) Next i cm2 = cm2.SuperClass --- 333,337 ---- For i = 1 To cm2.getFindSize am = cm2.FindAttributeMaps(i) ! statement.addSqlParameter(i, obj.getValueByAttribute(am.Name), am.ColumnMap) Next i cm2 = cm2.SuperClass *************** *** 310,324 **** For i = 1 To cm2.getKeySize am = cm2.getKeyAttributeMap(i) ! al.Add(cm2.RelationalDatabase.getValueFor(obj.getValueByAttribute(am.Name))) Next i cm2 = Nothing End If Loop While Not cm2 Is Nothing - Dim statement As CSqlStatement - If useFind Then - statement = cm.getSQLFind(Me, al) - Else - statement = cm.getSQLRetrieve(Me, al) - End If joins = cm.Joins --- 339,347 ---- For i = 1 To cm2.getKeySize am = cm2.getKeyAttributeMap(i) ! statement.addSqlParameter(i, obj.getValueByAttribute(am.Name), am.ColumnMap) Next i cm2 = Nothing End If Loop While Not cm2 Is Nothing joins = cm.Joins *************** *** 749,781 **** Debug.WriteLine("Saving object " & cm.Name) - 'No need to do anything with shared class tables here. Other code handles it - ' - 'Dim sharedClass As Boolean - 'sharedClass = True - 'Do - ' If sharedClass Then SharedClassMapStack.Push(cm) - ' If cm.SharedTableField Is Nothing Then - ' sharedClass = False - ' Else - ' sharedClass = True - ' End If - ' cm = cm.SuperClass - 'Loop While Not cm Is Nothing - 'Do While SharedClassMapStack.Count > 0 - ' cm = SharedClassMapStack.Pop - ' If obj.Persistent Then - ' statement = cm.getUpdateSqlFor(obj) - ' conn.processStatement(statement) - ' Else - ' statement = cm.getInsertSqlFor(obj) - ' conn.processStatement(statement) - ' If cm.getIdentitySize > 0 Then - ' If CInt(cm.RelationalDatabase.getValueFor(obj.getValueByAttribute(cm.getIdentityAttributeMap(1).Name))) = 0 Then - ' obj.setAttributeValue(cm.getIdentityAttributeMap(1).Name, cm.RelationalDatabase.getIdentityValue(conn)) - ' End If - ' End If - ' End If - 'Loop - If obj.Persistent Then statement = cm.getUpdateSqlFor(obj) --- 772,775 ---- *************** *** 791,795 **** End If - 'Need to reset the modified date to the new modified date after saving. 'If we don't do this the object won't get saved correctly on subsequent calls. --- 785,788 ---- Index: CClassMap.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CClassMap.vb,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** CClassMap.vb 6 Oct 2004 07:44:25 -0000 1.30 --- CClassMap.vb 6 Oct 2004 23:42:23 -0000 1.31 *************** *** 767,774 **** map = Me.getKeyAttributeMap(i) If i = 1 Then ! m_deleteStatement.addSqlClause(map.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(obj.getValueByAttribute(map.Name)))) Else ! m_deleteStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & map.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(obj.getValueByAttribute(map.Name)))) End If Next i End If --- 767,777 ---- map = Me.getKeyAttributeMap(i) If i = 1 Then ! 'm_deleteStatement.addSqlClause(map.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(obj.getValueByAttribute(map.Name)))) ! m_deleteStatement.addSqlClause(map.ColumnMap.getFullyQualifiedName & "=" & m_relationalDatabase.getParamHolder(i)) Else ! 'm_deleteStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & map.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(obj.getValueByAttribute(map.Name)))) ! m_deleteStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & map.ColumnMap.getFullyQualifiedName & "=" & m_relationalDatabase.getParamHolder(i)) End If + m_deleteStatement.addSqlParameter(i, obj.getValueByAttribute(map.Name), map.ColumnMap) Next i End If *************** *** 1090,1094 **** ' ' Identity columns with null values should not be included in the insert statement. ! ' The database will populate the column. ' --- 1093,1097 ---- ' ' Identity columns with null values should not be included in the insert statement. ! ' The database will populate them during the insert. ' *************** *** 1101,1104 **** --- 1104,1108 ---- Dim AttrMap As CAttributeMap Dim i As Short + Dim paramCount As Short ' *************** *** 1205,1209 **** End If Dim AttrMap As CAttributeMap ! Dim i As Short Dim isFirst As Boolean --- 1209,1213 ---- End If Dim AttrMap As CAttributeMap ! Dim i As Short, paramCount As Short Dim isFirst As Boolean *************** *** 1246,1249 **** --- 1250,1254 ---- End If Next i + paramCount = Me.getSize 'Add WHERE clause m_updateStatement.addSqlClause(" " & RelationalDatabase.getClauseStringWhere & " ") *************** *** 1258,1267 **** For i = 1 To Me.getKeySize AttrMap = Me.getKeyAttributeMap(i) ! keyValuesCol.Add(m_relationalDatabase.getValueFor(obj.OriginalCacheKey.GetKeyValue(i))) Next Else For i = 1 To Me.getKeySize AttrMap = Me.getKeyAttributeMap(i) ! keyValuesCol.Add(m_relationalDatabase.getValueFor(obj.getValueByAttribute(AttrMap.Name))) Next End If --- 1263,1274 ---- For i = 1 To Me.getKeySize AttrMap = Me.getKeyAttributeMap(i) ! 'keyValuesCol.Add(m_relationalDatabase.getValueFor(obj.OriginalCacheKey.GetKeyValue(i))) ! keyValuesCol.Add(obj.OriginalCacheKey.GetKeyValue(i)) Next Else For i = 1 To Me.getKeySize AttrMap = Me.getKeyAttributeMap(i) ! 'keyValuesCol.Add(m_relationalDatabase.getValueFor(obj.getValueByAttribute(AttrMap.Name))) ! keyValuesCol.Add(obj.getValueByAttribute(AttrMap.Name)) Next End If *************** *** 1269,1278 **** For i = 1 To Me.getKeySize AttrMap = Me.getKeyAttributeMap(i) If Not isFirst Then ! m_updateStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & AttrMap.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(keyValuesCol.Item(i)))) Else ! m_updateStatement.addSqlClause("" & AttrMap.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(keyValuesCol.Item(i)))) isFirst = False End If Next i If Not Me.SharedTableField Is Nothing Then --- 1276,1289 ---- For i = 1 To Me.getKeySize AttrMap = Me.getKeyAttributeMap(i) + paramCount += 1 If Not isFirst Then ! 'm_updateStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & AttrMap.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(keyValuesCol.Item(i)))) ! m_updateStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & AttrMap.ColumnMap.getFullyQualifiedName & "=" & m_relationalDatabase.getParamHolder(paramCount)) Else ! 'm_updateStatement.addSqlClause("" & AttrMap.ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(keyValuesCol.Item(i)))) ! m_updateStatement.addSqlClause("" & AttrMap.ColumnMap.getFullyQualifiedName & "=" & m_relationalDatabase.getParamHolder(paramCount)) isFirst = False End If + m_updateStatement.addSqlParameter(paramCount, keyValuesCol.Item(i), AttrMap.ColumnMap) Next i If Not Me.SharedTableField Is Nothing Then *************** *** 1287,1291 **** 'process timestamp attributes If Me.getAttributeMap(i).isTimeStamp Then ! m_updateStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & Me.getAttributeMap(i).ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(obj.getValueByAttribute("Original" & Me.getAttributeMap(i).Name)))) End If Next i --- 1298,1305 ---- 'process timestamp attributes If Me.getAttributeMap(i).isTimeStamp Then ! paramCount += 1 ! 'm_updateStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & Me.getAttributeMap(i).ColumnMap.getFullyQualifiedName & m_relationalDatabase.getClauseStringEqualTo(m_relationalDatabase.getValueFor(obj.getValueByAttribute("Original" & Me.getAttributeMap(i).Name)))) ! m_updateStatement.addSqlClause(" " & RelationalDatabase.getClauseStringAnd & " " & Me.getAttributeMap(i).ColumnMap.getFullyQualifiedName & "=" & m_relationalDatabase.getParamHolder(paramCount)) ! m_updateStatement.addSqlParameter(paramCount, obj.getValueByAttribute("Original" & Me.getAttributeMap(i).Name), Me.getAttributeMap(i).ColumnMap) End If Next i *************** *** 1717,1731 **** Dim i As Integer = 1 If m_sqlRetrieveStub.Length > 0 Then ! Dim x As String = m_sqlRetrieveStub ! For Each s As String In args ! If s = "NULL" Then ! x = x.Replace(" = _" & i.ToString & "_", " is NULL") ! Else ! x = x.Replace("_" & i.ToString & "_", s) ! End If ! i += 1 ! Next ! statement.SqlString = x Return statement End If --- 1731,1747 ---- Dim i As Integer = 1 If m_sqlRetrieveStub.Length > 0 Then ! statement.SqlString = m_sqlRetrieveStub Return statement + 'Dim x As String = m_sqlRetrieveStub + 'For Each s As String In args + ' If s = "NULL" Then + ' x = x.Replace(" = _" & i.ToString & "_", " is NULL") + ' Else + ' x = x.Replace("_" & i.ToString & "_", s) + ' End If + ' i += 1 + 'Next + 'statement.SqlString = x + 'Return statement End If *************** *** 1814,1819 **** isfirst = False End If statement.addSqlClause(" " & am.ColumnMap.getAliasQualifiedName(mapName) _ ! & cm2.RelationalDatabase.getClauseStringEqualTo("_" & i.ToString & "_")) Next i cm2 = Nothing --- 1830,1837 ---- isfirst = False End If + 'statement.addSqlClause(" " & am.ColumnMap.getAliasQualifiedName(mapName) _ + ' & cm2.RelationalDatabase.getClauseStringEqualTo("_" & i.ToString & "_")) statement.addSqlClause(" " & am.ColumnMap.getAliasQualifiedName(mapName) _ ! & " = " & cm2.RelationalDatabase.getParamHolder(i)) Next i cm2 = Nothing *************** *** 1830,1844 **** Dim i As Integer = 1 If m_sqlFindStub.Length > 0 Then ! Dim x As String = m_sqlFindStub ! For Each s As String In args ! If s = "NULL" Then ! x = x.Replace(" = _" & i.ToString & "_", " is NULL") ! Else ! x = x.Replace("_" & i.ToString & "_", s) ! End If ! i += 1 ! Next ! statement.SqlString = x Return statement End If --- 1848,1864 ---- Dim i As Integer = 1 If m_sqlFindStub.Length > 0 Then ! statement.SqlString = m_sqlFindStub Return statement + 'Dim x As String = m_sqlFindStub + 'For Each s As String In args + ' If s = "NULL" Then + ' x = x.Replace(" = _" & i.ToString & "_", " is NULL") + ' Else + ' x = x.Replace("_" & i.ToString & "_", s) + ' End If + ' i += 1 + 'Next + 'statement.SqlString = x + 'Return statement End If *************** *** 1929,1934 **** isfirst = False End If statement.addSqlClause(" " & am.ColumnMap.getAliasQualifiedName(mapName) _ ! & cm2.RelationalDatabase.getClauseStringEqualTo("_" & i.ToString & "_")) Next i cm2 = Nothing --- 1949,1956 ---- isfirst = False End If + 'statement.addSqlClause(" " & am.ColumnMap.getAliasQualifiedName(mapName) _ + ' & cm2.RelationalDatabase.getClauseStringEqualTo("_" & i.ToString & "_")) statement.addSqlClause(" " & am.ColumnMap.getAliasQualifiedName(mapName) _ ! & " = " & cm2.RelationalDatabase.getParamHolder(i)) Next i cm2 = Nothing |
From: Richard B. <rb...@us...> - 2004-10-06 07:44:51
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12660 Modified Files: CClassMap.vb CPersistenceBroker.vb Log Message: Fix for code based attribute mappings using superclasses with OID/GUID keys Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** CPersistenceBroker.vb 28 Sep 2004 07:30:32 -0000 1.58 --- CPersistenceBroker.vb 6 Oct 2004 07:44:28 -0000 1.59 *************** *** 1795,1804 **** AttrMap.ColumnMap = colMap AttrMap.IsProxy = True - If Not afTable.KeyReference Is Nothing And Not afTable.SuperClass Is Nothing Then - refAttr = ClassMap.SuperClass.getAttributeMapByString(afTable.KeyReference, True) - If Not refAttr Is Nothing Then - AttrMap.AttributeMap = refAttr - End If - End If Try AttrMap.ColumnMap.StorageSize = cc.Item(AttrMap.ColumnMap.Name) --- 1795,1798 ---- *************** *** 1881,1884 **** --- 1875,1892 ---- 'Create a column map for the sharedtablefield colMap = New CColumnMap + If afTable.DBKey = AFTableAttribute.KeyType.useGUIDValue Or afTable.DBKey = AFTableAttribute.KeyType.useOIDValue Then + Select Case afTable.DBKey + Case AFTableAttribute.KeyType.useOIDValue + AttrMap = ClassMap.getAttributeMapByString("OIDValue", False) + Case AFTableAttribute.KeyType.useGUIDValue + AttrMap = ClassMap.getAttributeMapByString("GUIDValue", False) + End Select + If Not afTable.KeyReference Is Nothing And Not afTable.SuperClass Is Nothing Then + refAttr = ClassMap.SuperClass.getAttributeMapByString(afTable.KeyReference, True) + If Not refAttr Is Nothing Then + AttrMap.AttributeMap = refAttr + End If + End If + End If Try colMap.StorageSize = cc.Item(ClassMap.SharedTableField) Index: CClassMap.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CClassMap.vb,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** CClassMap.vb 28 Sep 2004 04:18:54 -0000 1.29 --- CClassMap.vb 6 Oct 2004 07:44:25 -0000 1.30 *************** *** 731,735 **** Throw New NoAttributeMapException([String].Format("Attribute map not found for ""{0}"" in class {1}. Please check spelling and case", Name, Me.Name)) End If ! getAttributeMapByString = am End Function --- 731,735 ---- Throw New NoAttributeMapException([String].Format("Attribute map not found for ""{0}"" in class {1}. Please check spelling and case", Name, Me.Name)) End If ! Return am End Function |