Update of /cvsroot/jcframework/FrameworkMapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5004 Modified Files: COptions.vb FrmMain.resx FrmMain.vb frmAddDatabase.resx frmAddDatabase.vb frmClassInfo.resx frmClassInfo.vb frmClasses.vb frmDatabases.vb frmOptions.resx frmOptions.vb frmProjectProperties.resx frmProjectProperties.vb frmProperties.vb Added Files: AtomsFrameworkMapper.suo AtomsFrameworkMapper.vbproj WeifenLuo.WinFormsUI.dll WeifenLuo.WinFormsUI.pdb Log Message: Major update to incorporate CodeSmith scripts, and integration with WinMerge for viewing differences. Index: frmProperties.vb =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmProperties.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmProperties.vb 12 Oct 2004 23:10:17 -0000 1.1 +++ frmProperties.vb 10 Dec 2004 04:31:12 -0000 1.2 @@ -1,36 +1,38 @@ +Imports AFMappingClasses + Public Class frmProperties - Inherits WeifenLuo.WinFormsUI.DockContent + Inherits WeifenLuo.WinFormsUI.DockContent Friend CurrentObject As Object #Region " Windows Form Designer generated code " - Public Sub New() - MyBase.New() + Public Sub New() + MyBase.New() - 'This call is required by the Windows Form Designer. - InitializeComponent() + 'This call is required by the Windows Form Designer. + InitializeComponent() - 'Add any initialization after the InitializeComponent() call + 'Add any initialization after the InitializeComponent() call - End Sub + 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 + '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 + '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. + '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 PropertyGrid1 As System.Windows.Forms.PropertyGrid <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() @@ -71,9 +73,9 @@ Me.Controls.Add(Me.PropertyGrid1) Me.Controls.Add(Me.Label1) 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) + 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 = "frmProperties" Index: FrmMain.resx =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/FrmMain.resx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FrmMain.resx 12 Oct 2004 23:10:17 -0000 1.1 +++ FrmMain.resx 10 Dec 2004 04:31:12 -0000 1.2 @@ -196,6 +196,21 @@ <data name="mnuOptions.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> + <data name="MenuItem4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="MenuItem4.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="DockPanel1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="DockPanel1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="DockPanel1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </data> <data name="SaveFileDialog1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> @@ -214,15 +229,12 @@ <data name="OpenFileDialog1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>254, 17</value> </data> - <data name="DockPanel1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <data name="MenuItem7.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> - <data name="DockPanel1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <data name="MenuItem7.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> - <data name="DockPanel1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>False</value> - </data> <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> --- NEW FILE: AtomsFrameworkMapper.vbproj --- <VisualStudioProject> <VisualBasic ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{F656650C-9484-4E0F-AC0B-0358E133FB96}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "AtomsFrameworkMapper" AssemblyOriginatorKeyFile = "" AssemblyOriginatorKeyMode = "None" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "WinExe" OptionCompare = "Binary" OptionExplicit = "On" OptionStrict = "Off" RootNamespace = "AtomsFrameworkMapper" StartupObject = "AtomsFrameworkMapper.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" /> <Reference Name = "AFMappingClasses" Project = "{AD59B3EC-022E-4CEB-B625-BB56C75A2255}" Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}" /> <Reference Name = "CodeSmithDataClasses" Project = "{FB3D28DB-55C0-4068-A9F3-23412147768C}" Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}" /> </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 = "COptions.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 = "Form" BuildAction = "Compile" /> <File RelPath = "frmClasses.resx" DependentUpon = "frmClasses.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmClassInfo.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "frmClassInfo.resx" DependentUpon = "frmClassInfo.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmDatabases.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "frmDatabases.resx" DependentUpon = "frmDatabases.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "FrmMain.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "FrmMain.resx" DependentUpon = "FrmMain.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmOptions.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "frmOptions.resx" DependentUpon = "frmOptions.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmProjectProperties.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "frmProjectProperties.resx" DependentUpon = "frmProjectProperties.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "frmProperties.vb" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "frmProperties.resx" DependentUpon = "frmProperties.vb" BuildAction = "EmbeddedResource" /> <File RelPath = "Images\Class.ico" BuildAction = "Content" /> <File RelPath = "Images\Database.ico" BuildAction = "Content" /> <File RelPath = "Images\OpenFolder.ICO" BuildAction = "Content" /> <File RelPath = "Images\Property.ico" BuildAction = "Content" /> <File RelPath = "Images\SQLColumn.ico" BuildAction = "Content" /> <File RelPath = "Images\SQLTable.ico" BuildAction = "Content" /> <File RelPath = "Images\SQLView.ico" BuildAction = "Content" /> </Include> </Files> </VisualBasic> </VisualStudioProject> --- NEW FILE: AtomsFrameworkMapper.suo --- (This appears to be a binary file; contents omitted.) Index: frmProjectProperties.resx =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmProjectProperties.resx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmProjectProperties.resx 12 Oct 2004 23:10:17 -0000 1.1 +++ frmProjectProperties.resx 10 Dec 2004 04:31:12 -0000 1.2 @@ -169,13 +169,13 @@ <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"> + <data name="cmbClassScript.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"> + <data name="cmbClassScript.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"> + <data name="cmbClassScript.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"> @@ -187,6 +187,42 @@ <data name="Label4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> + <data name="Label5.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </data> + <data name="Label5.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="Label5.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="cmbXMLScript.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="cmbXMLScript.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </data> + <data name="cmbXMLScript.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="Label6.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </data> + <data name="Label6.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="Label6.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="cmbDBSchema.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="cmbDBSchema.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </data> + <data name="cmbDBSchema.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> @@ -196,9 +232,6 @@ <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> @@ -211,6 +244,9 @@ <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> + <data name="$this.Name"> + <value>frmProjectProperties</value> + </data> <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> Index: frmClassInfo.vb =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmClassInfo.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmClassInfo.vb 12 Oct 2004 23:10:17 -0000 1.1 +++ frmClassInfo.vb 10 Dec 2004 04:31:12 -0000 1.2 @@ -1,4 +1,5 @@ Imports System.Data +Imports AFMappingClasses Public Class frmClassInfo Inherits WeifenLuo.WinFormsUI.DockContent @@ -33,7 +34,6 @@ '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 CMappedAttributeCollection1 As FrameworkMapper.CMappedAttributeCollection Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid Friend WithEvents DataGridTableStyle1 As System.Windows.Forms.DataGridTableStyle Friend WithEvents DataGridTextBoxColumn1 As System.Windows.Forms.DataGridTextBoxColumn @@ -45,7 +45,6 @@ Friend WithEvents DataGridBoolColumn4 As System.Windows.Forms.DataGridBoolColumn Friend WithEvents DataGridBoolColumn5 As System.Windows.Forms.DataGridBoolColumn Friend WithEvents DataGridTextBoxColumn4 As System.Windows.Forms.DataGridTextBoxColumn - Friend WithEvents CAssociationEntryCollection1 As FrameworkMapper.CAssociationEntryCollection Friend WithEvents Splitter1 As System.Windows.Forms.Splitter Friend WithEvents Splitter2 As System.Windows.Forms.Splitter Friend WithEvents Panel2 As System.Windows.Forms.Panel @@ -53,10 +52,10 @@ Friend WithEvents ListView1 As System.Windows.Forms.ListView Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu Friend WithEvents mnuDeleteAssociation As System.Windows.Forms.MenuItem + Friend WithEvents CMappedAttributeCollection2 As AFMappingClasses.CMappedAttributeCollection + Friend WithEvents CAssociationEntryCollection2 As AFMappingClasses.CAssociationEntryCollection <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmClassInfo)) - Me.CMappedAttributeCollection1 = New FrameworkMapper.CMappedAttributeCollection - Me.CAssociationEntryCollection1 = New FrameworkMapper.CAssociationEntryCollection Me.DataGrid1 = New System.Windows.Forms.DataGrid Me.DataGridTableStyle1 = New System.Windows.Forms.DataGridTableStyle Me.DataGridTextBoxColumn1 = New System.Windows.Forms.DataGridTextBoxColumn @@ -75,21 +74,19 @@ Me.ListView1 = New System.Windows.Forms.ListView Me.ContextMenu1 = New System.Windows.Forms.ContextMenu Me.mnuDeleteAssociation = New System.Windows.Forms.MenuItem + Me.CMappedAttributeCollection2 = New AFMappingClasses.CMappedAttributeCollection + Me.CAssociationEntryCollection2 = New AFMappingClasses.CAssociationEntryCollection CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel2.SuspendLayout() CType(Me.DataGrid2, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' - 'CAssociationEntryCollection1 - ' - Me.CAssociationEntryCollection1.parentAssociation = Nothing - ' 'DataGrid1 ' Me.DataGrid1.AllowDrop = True Me.DataGrid1.CaptionText = "Attributes" Me.DataGrid1.DataMember = "" - Me.DataGrid1.DataSource = Me.CMappedAttributeCollection1 + Me.DataGrid1.DataSource = Me.CMappedAttributeCollection2 Me.DataGrid1.Dock = System.Windows.Forms.DockStyle.Fill Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.DataGrid1.Location = New System.Drawing.Point(0, 0) @@ -214,7 +211,7 @@ ' Me.DataGrid2.CaptionText = "Association Entries" Me.DataGrid2.DataMember = "" - Me.DataGrid2.DataSource = Me.CAssociationEntryCollection1 + Me.DataGrid2.DataSource = Me.CAssociationEntryCollection2 Me.DataGrid2.Dock = System.Windows.Forms.DockStyle.Fill Me.DataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.DataGrid2.Location = New System.Drawing.Point(181, 0) @@ -242,6 +239,10 @@ Me.mnuDeleteAssociation.Index = 0 Me.mnuDeleteAssociation.Text = "Delete" ' + 'CAssociationEntryCollection2 + ' + Me.CAssociationEntryCollection2.parentAssociation = Nothing + ' 'frmClassInfo ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Index: frmClasses.vb =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmClasses.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmClasses.vb 12 Oct 2004 23:10:17 -0000 1.1 +++ frmClasses.vb 10 Dec 2004 04:31:12 -0000 1.2 @@ -1,4 +1,5 @@ Imports WeifenLuo.WinFormsUI +Imports AFMappingClasses Public Class frmClasses Inherits WeifenLuo.WinFormsUI.DockContent Index: frmOptions.vb =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmOptions.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmOptions.vb 12 Oct 2004 23:10:17 -0000 1.1 +++ frmOptions.vb 10 Dec 2004 04:31:12 -0000 1.2 @@ -1,4 +1,5 @@ Imports System.IO +Imports AFMappingClasses Public Class frmOptions Inherits System.Windows.Forms.Form @@ -35,11 +36,19 @@ Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents txtTemplateDir As System.Windows.Forms.TextBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents txtCodeSmith As System.Windows.Forms.TextBox + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents txtDiffUtil 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.Label2 = New System.Windows.Forms.Label + Me.txtCodeSmith = New System.Windows.Forms.TextBox + Me.Label3 = New System.Windows.Forms.Label + Me.txtDiffUtil = New System.Windows.Forms.TextBox Me.SuspendLayout() ' 'Label1 @@ -48,7 +57,7 @@ Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(108, 23) Me.Label1.TabIndex = 0 - Me.Label1.Text = "Template Directory" + Me.Label1.Text = "Script Directory" ' 'txtTemplateDir ' @@ -72,16 +81,51 @@ Me.Button1.TabIndex = 6 Me.Button1.Text = "OK" ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(16, 64) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(116, 23) + Me.Label2.TabIndex = 8 + Me.Label2.Text = "CodeSmith Directory" + ' + 'txtCodeSmith + ' + Me.txtCodeSmith.Location = New System.Drawing.Point(148, 62) + Me.txtCodeSmith.Name = "txtCodeSmith" + Me.txtCodeSmith.Size = New System.Drawing.Size(164, 20) + Me.txtCodeSmith.TabIndex = 9 + Me.txtCodeSmith.Text = "" + ' + 'Label3 + ' + Me.Label3.Location = New System.Drawing.Point(16, 98) + Me.Label3.Name = "Label3" + Me.Label3.TabIndex = 10 + Me.Label3.Text = "Diff Utility" + ' + 'txtDiffUtil + ' + Me.txtDiffUtil.Location = New System.Drawing.Point(148, 94) + Me.txtDiffUtil.Name = "txtDiffUtil" + Me.txtDiffUtil.Size = New System.Drawing.Size(166, 20) + Me.txtDiffUtil.TabIndex = 11 + Me.txtDiffUtil.Text = "" + ' 'frmOptions ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(368, 158) + Me.Controls.Add(Me.txtDiffUtil) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.txtCodeSmith) + Me.Controls.Add(Me.Label2) 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.Text = "frmOptions" Me.ResumeLayout(False) End Sub @@ -93,21 +137,34 @@ 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() + o.ScriptDirectory = txtTemplateDir.Text 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() + o.ScriptDirectory = txtTemplateDir.Text + Else + o.ScriptDirectory = "" End If End If + If d.Exists(txtCodeSmith.Text) Then + o.CodeSmithDirectory = txtCodeSmith.Text + Else + o.CodeSmithDirectory = "" + End If + Dim f As File + If f.Exists(txtDiffUtil.Text) Then + o.DiffUtil = txtDiffUtil.Text + Else + o.DiffUtil = "" + End If + o.Save() + Me.Close() End Sub Private Sub frmOptions_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load - txtTemplateDir.Text = o.TemplateDirectory + txtTemplateDir.Text = o.ScriptDirectory + txtCodeSmith.Text = o.CodeSmithDirectory + txtDiffUtil.Text = o.DiffUtil End Sub Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Index: frmOptions.resx =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmOptions.resx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmOptions.resx 12 Oct 2004 23:10:17 -0000 1.1 +++ frmOptions.resx 10 Dec 2004 04:31:12 -0000 1.2 @@ -133,9 +133,48 @@ <data name="Button1.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="txtCodeSmith.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="txtCodeSmith.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="txtCodeSmith.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</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="txtDiffUtil.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Assembly</value> + </data> + <data name="txtDiffUtil.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </data> + <data name="txtDiffUtil.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> @@ -145,21 +184,18 @@ <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.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>(Default)</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.Name"> - <value>frmOptions</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.Name"> + <value>frmOptions</value> + </data> <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> Index: frmAddDatabase.resx =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmAddDatabase.resx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmAddDatabase.resx 12 Oct 2004 23:10:17 -0000 1.1 +++ frmAddDatabase.resx 10 Dec 2004 04:31:12 -0000 1.2 @@ -124,12 +124,12 @@ <data name="ComboBox1.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.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </data> <data name="Label2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> @@ -163,12 +163,12 @@ <data name="GroupBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> - <data name="GroupBox1.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>True</value> - </data> <data name="GroupBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Assembly</value> </data> + <data name="GroupBox1.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </data> <data name="lblParam3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> Index: FrmMain.vb =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/FrmMain.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FrmMain.vb 12 Oct 2004 23:10:17 -0000 1.1 +++ FrmMain.vb 10 Dec 2004 04:31:12 -0000 1.2 @@ -1,17 +1,13 @@ Imports System.IO Imports WeifenLuo.WinFormsUI Imports System.Xml +Imports AFMappingClasses +Imports System.ComponentModel +Imports CodeSmithDataClasses Public Class FrmMain Inherits System.Windows.Forms.Form - 'TODO: Link db properties (frmAddDatabase) to existing databases - 'TODO: Add db code to get schema for access/odbc/mysql - 'TODO: Flesh out association collections - 'TODO: Add ability to add new classes - 'TODO: Generate XML schema from mappings - 'TODO: Think about code generation templates - Public p As CProject Public opt As COptions Friend fClasses As New frmClasses @@ -67,6 +63,8 @@ Friend WithEvents mnuProperties As System.Windows.Forms.MenuItem Friend WithEvents mnuGenerateXML As System.Windows.Forms.MenuItem Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem + Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem + Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.MainMenu1 = New System.Windows.Forms.MainMenu Me.MenuItem1 = New System.Windows.Forms.MenuItem @@ -84,9 +82,11 @@ Me.mnuGenerateXML = New System.Windows.Forms.MenuItem Me.MenuItem6 = New System.Windows.Forms.MenuItem Me.mnuOptions = New System.Windows.Forms.MenuItem + Me.MenuItem4 = New System.Windows.Forms.MenuItem + Me.DockPanel1 = New WeifenLuo.WinFormsUI.DockPanel Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog - Me.DockPanel1 = New WeifenLuo.WinFormsUI.DockPanel + Me.MenuItem7 = New System.Windows.Forms.MenuItem Me.SuspendLayout() ' 'MainMenu1 @@ -154,7 +154,7 @@ 'MenuItem2 ' Me.MenuItem2.Index = 3 - Me.MenuItem2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuGenerateXML, Me.MenuItem6, Me.mnuOptions}) + Me.MenuItem2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuGenerateXML, Me.MenuItem7, Me.MenuItem4, Me.MenuItem6, Me.mnuOptions}) Me.MenuItem2.Text = "Tools" ' 'mnuGenerateXML @@ -164,21 +164,18 @@ ' 'MenuItem6 ' - Me.MenuItem6.Index = 1 + Me.MenuItem6.Index = 3 Me.MenuItem6.Text = "-" ' 'mnuOptions ' - Me.mnuOptions.Index = 2 + Me.mnuOptions.Index = 4 Me.mnuOptions.Text = "Options..." ' - 'SaveFileDialog1 - ' - Me.SaveFileDialog1.Filter = "AtomsFramework XML Mapping Projects (*.axproj)|*.axproj" - ' - 'OpenFileDialog1 + 'MenuItem4 ' - Me.OpenFileDialog1.Filter = "AtomsFramework XML Mapping Projects (*.axproj)|*.axproj" + Me.MenuItem4.Index = 2 + Me.MenuItem4.Text = "Generate Database Schema" ' 'DockPanel1 ' @@ -188,7 +185,20 @@ Me.DockPanel1.Location = New System.Drawing.Point(0, 0) Me.DockPanel1.Name = "DockPanel1" Me.DockPanel1.Size = New System.Drawing.Size(560, 478) - Me.DockPanel1.TabIndex = 1 + Me.DockPanel1.TabIndex = 0 + ' + 'SaveFileDialog1 + ' + Me.SaveFileDialog1.Filter = "AtomsFramework XML Mapping Projects (*.axproj)|*.axproj" + ' + 'OpenFileDialog1 + ' + Me.OpenFileDialog1.Filter = "AtomsFramework XML Mapping Projects (*.axproj)|*.axproj" + ' + 'MenuItem7 + ' + Me.MenuItem7.Index = 1 + Me.MenuItem7.Text = "Generate Class Code" ' 'FrmMain ' @@ -198,7 +208,7 @@ Me.IsMdiContainer = True Me.Menu = Me.MainMenu1 Me.Name = "FrmMain" - Me.Text = "FrameworkMapper " + Me.Text = "AtomsFramework Code Generator" Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.ResumeLayout(False) @@ -309,8 +319,11 @@ elem = xdoc.CreateElement("XMLMappingFile") elem.InnerText = p.XMLMappingFile root.AppendChild(elem) - elem = xdoc.CreateElement("TemplateSet") - elem.InnerText = p.TemplateSet + elem = xdoc.CreateElement("BusinessClassScript") + elem.InnerText = p.BusinessClassScript + root.AppendChild(elem) + elem = xdoc.CreateElement("XMLScript") + elem.InnerText = p.XMLMappingScript root.AppendChild(elem) xdoc.AppendChild(root) xdoc.Save(p.FileName) @@ -345,8 +358,11 @@ If elem.Name = "XMLMappingFile" Then newproj.XMLMappingFile = elem.InnerText End If - If elem.Name = "TemplateSet" Then - newproj.TemplateSet = elem.InnerText + If elem.Name = "BusinessClassScript" Then + newproj.BusinessClassScript = elem.InnerText + End If + If elem.Name = "XMLScript" Then + newproj.XMLMappingScript = elem.InnerText End If elem = elem.NextSibling End While @@ -423,15 +439,427 @@ End Sub Private Sub mnuGenerateXML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGenerateXML.Click - SaveFileDialog1.FileName = "AtomsFramework.xml" - SaveFileDialog1.Filter = "XML File(*.xml)|*.xml" - If SaveFileDialog1.ShowDialog(Me) <> DialogResult.OK Then - MsgBox("XML Mapping file was not generated") + If p.XMLMappingScript = String.Empty Then + MsgBox("You need to select an XML Mapping script in the project properties") Exit Sub End If + Dim xn_db As XmlNode + Dim xn_cls As XmlNode + Dim overwrite As Boolean - Dim x As New CXMLMapper(SaveFileDialog1.FileName, p) - x.Save() - MsgBox("XML Mapping file was generated") + Dim tc As DatabaseTypeConverter + tc = New DatabaseTypeConverter + Dim dbcollection As New DatabaseCollection + Dim cs_db As DatabaseMap + For Each d As CMappedDatabase In p.databases + cs_db = New DatabaseMap + cs_db.dbname = d.dbname + cs_db.dbType = d.dbType + cs_db.NameParam = d.NameParam + cs_db.OIDTable = d.OIDTable + cs_db.options = d.options + cs_db.password = d.password + cs_db.portNumber = d.portNumber + cs_db.serverName = d.serverName + cs_db.user = d.user + cs_db.tables = New DatabaseTableCollection + dbcollection.Add(cs_db) + Next d + + Dim clsConv As New ClassMapTypeConverter + Dim clsCollection As New ClassMapCollection + Dim cls As ClassMap + Dim att As AttributeMap + Dim assoc As Association + Dim assocEntry As AssociationEntry + For Each c As CMappedClass In p.classes + cls = New ClassMap + cls.ClassName = c.ClassName + cls.classNamespace = c.ClassNameSpace + cls.databaseName = c.DatabaseName + cls.table = c.Table + cls.tableOwner = c.TableOwner + cls.modifyOnlyFlag = c.ModifyOnlyFlag + cls.readOnlyFlag = c.ReadOnlyFlag + cls.sharedField = c.SharedField + cls.sharedValue = c.SharedValue + cls.SourceFile = c.SourceFile + cls.assemblyPath = c.AssemblyPath + cls.factory = c.Factory + cls.associations = New AssociationCollection + cls.attributes = New CodeSmithDataClasses.AttributeCollection + If Not c.SuperClass Is Nothing Then + cls.superClassName = c.SuperClass.ClassName + cls.superClassNameSpace = c.SuperClass.ClassNameSpace + End If + For Each a As CMappedAttribute In c.Attributes + att = New AttributeMap + att.column = a.Column + att.isFind = a.isFind + att.isIdentity = a.isIdentity + att.isKey = a.isKey + att.isProxy = a.isProxy + att.isTimeStamp = a.isTimeStamp + att.Name = a.Name + att.referenceToParentField = a.Reference + cls.attributes.Add(att) + Next + For Each ass As CMappedAssociation In c.Associations + assoc = New Association + If ass.Name <> "No Target" Then + assoc.name = ass.Name + End If + assoc.cardinality = ass.Cardinality + assoc.deleteAuto = ass.DeleteAuto + assoc.fromClass = ass.FromClassName + assoc.retrieveAuto = ass.RetrieveAuto + assoc.lazyLoad = ass.LazyLoad + assoc.saveAuto = ass.SaveAuto + assoc.target = ass.TargetAttribute.Name + assoc.toClass = ass.ToClassName + If ass.FromClassNamespace <> String.Empty Then + assoc.fromNamespace = ass.FromClassNamespace + Else + assoc.fromNamespace = ass.FromClass.ClassNameSpace + End If + If ass.ToClassNamespace <> String.Empty Then + assoc.toNamespace = ass.ToClassNamespace + Else + assoc.toNamespace = ass.ToClass.ClassNameSpace + End If + assoc.entries = New AssociationEntryCollection + For Each ent As CAssociationEntry In ass.Entries + assocEntry = New AssociationEntry + assocEntry.fromAttribute = ent.fromAttributeName + assocEntry.toAttribute = ent.toAttributeName + assoc.entries.Add(assocEntry) + Next + cls.associations.Add(assoc) + Next + clsCollection.Add(cls) + Next + xn_db = TypeDescriptor.GetConverter(dbcollection).ConvertTo(dbcollection, GetType(XmlNode)) + xn_cls = TypeDescriptor.GetConverter(clsCollection).ConvertTo(clsCollection, GetType(XmlNode)) + Dim xr As New System.Xml.XmlTextWriter(opt.ScriptDirectory & "\properties.xml", Nothing) + xr.WriteStartElement("codeSmith") + xr.WriteStartElement("propertySet") + xr.WriteStartElement("property") + xr.WriteAttributeString("name", "databases") + xr.WriteRaw(xn_db.OuterXml) + xr.WriteEndElement() + xr.WriteStartElement("property") + xr.WriteAttributeString("name", "classes") + xr.WriteRaw(xn_cls.OuterXml) + xr.WriteEndElement() + xr.WriteEndElement() + xr.Close() + Dim cmdString As String + cmdString = """" & opt.CodeSmithDirectory & "\CodeSmithConsole.exe"" " + cmdString &= "/template:""" & opt.ScriptDirectory & "\" & p.XMLMappingScript & """ " + cmdString &= "/properties:""" & opt.ScriptDirectory & "\properties.xml"" " + cmdString &= "/out:""" & opt.ScriptDirectory & "\new.xml""" + Shell(cmdString, AppWinStyle.NormalFocus, True) + overwrite = True + If Not FileCompare(opt.ScriptDirectory & "\new.xml", p.XMLMappingFile) Then + If opt.DiffUtil <> String.Empty Then + 'check tmp.xml vs original + cmdString = """" & opt.DiffUtil & """" + cmdString &= " """ & p.XMLMappingFile & """" + cmdString &= " """ & opt.ScriptDirectory & "\new.xml""" + Shell(cmdString, AppWinStyle.Hide, True) + Else + If Not MsgBox("Overwrite existing XML file?", MsgBoxStyle.YesNo) Then + overwrite = False + End If + End If + Else + overwrite = False + End If + If overwrite Then + File.Copy(p.XMLMappingFile, p.XMLMappingFile & ".bak") + File.Copy(opt.ScriptDirectory & "\new.xml", p.XMLMappingFile, True) + End If + End Sub + + Private Sub MenuItem4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click + If p.DBSchemaScript = String.Empty Then + MsgBox("You need to select a database schema script in the project properties") + Exit Sub + End If + Dim xn As System.Xml.XmlNode + Dim tc As DatabaseTypeConverter + tc = New DatabaseTypeConverter + Dim dbcollection As New DatabaseCollection + Dim cs_db As DatabaseMap + Dim cs_t As DatabaseTable + Dim cs_c As DatabaseColumn + For Each d As CMappedDatabase In p.databases + cs_db = New DatabaseMap + cs_db.dbname = d.dbname + cs_db.dbType = d.dbType + cs_db.NameParam = d.NameParam + cs_db.OIDTable = d.OIDTable + cs_db.options = d.options + cs_db.password = d.password + cs_db.portNumber = d.portNumber + cs_db.serverName = d.serverName + cs_db.user = d.user + cs_db.tables = New DatabaseTableCollection + For Each t As dbTable In d.tables + cs_t = New DatabaseTable + cs_t.parentDBName = cs_db.dbname + cs_t.tableName = t.tableName + cs_t.tableOwner = t.tableOwner + cs_t.tableType = t.tableType + cs_t.columns = New DatabaseColumnCollection + For Each c As dbColumn In t.columns + cs_c = New DatabaseColumn + cs_c.colName = c.colName + cs_c.colType = c.colType + cs_c.dotnetTypeName = c.dotnetTypeName + cs_c.isPrimaryKey = c.isPrimaryKey + cs_c.parentTableName = cs_t.tableName + cs_t.columns.Add(cs_c) + Next c + cs_db.tables.Add(cs_t) + Next t + dbcollection.Add(cs_db) + Next d + xn = TypeDescriptor.GetConverter(dbcollection).ConvertTo(dbcollection, GetType(System.Xml.XmlNode)) + 'Dim dd As New DatabaseCollection + 'dd = TypeDescriptor.GetConverter(dbcollection).ConvertFrom(xn) + Dim xr As New System.Xml.XmlTextWriter(opt.ScriptDirectory & "\properties.xml", Nothing) + xr.WriteStartElement("codeSmith") + xr.WriteStartElement("propertySet") + xr.WriteStartElement("property") + xr.WriteAttributeString("name", "d") + xr.WriteRaw(xn.OuterXml) + xr.WriteEndElement() + xr.WriteStartElement("property") + xr.WriteAttributeString("name", "classmaps") + xr.WriteRaw("somename") + xr.WriteEndElement() + xr.WriteStartElement("property") + xr.WriteAttributeString("name", "associations") + xr.WriteRaw("person") + xr.WriteEndElement() + xr.WriteEndElement() + xr.WriteEndElement() + xr.Close() + Dim cmdString As String + cmdString = """" & opt.CodeSmithDirectory & "\CodeSmithConsole.exe"" " + cmdString &= "/template:""" & opt.ScriptDirectory & "\" & p.DBSchemaScript & """ " + cmdString &= "/properties:""" & opt.ScriptDirectory & "\properties.xml"" " + cmdString &= "/out:default" + Shell(cmdString, AppWinStyle.NormalFocus) + End Sub + + 'this function courtesy of Microsoft - http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B320346 + Private Function FileCompare(ByVal file1 As String, ByVal file2 As String) As Boolean + Dim file1byte As Integer + Dim file2byte As Integer + Dim fs1 As FileStream + Dim fs2 As FileStream + + ' Determine if the same file was referenced two times. + If (file1 = file2) Then + ' Return 0 to indicate that the files are the same. + Return True + End If + + ' Open the two files. + Try + fs1 = New FileStream(file1, FileMode.Open) + fs2 = New FileStream(file2, FileMode.Open) + Catch + Return False + End Try + + ' Check the file sizes. If they are not the same, the files + ' are not equal. + If (fs1.Length <> fs2.Length) Then + ' Close the file + fs1.Close() + fs2.Close() + + ' Return a non-zero value to indicate that the files are different. + Return False + End If + + ' Read and compare a byte from each file until either a + ' non-matching set of bytes is found or until the end of + ' file1 is reached. + Do + ' Read one byte from each file. + file1byte = fs1.ReadByte() + file2byte = fs2.ReadByte() + Loop While ((file1byte = file2byte) And (file1byte <> -1)) + + ' Close the files. + fs1.Close() + fs2.Close() + + ' Return the success of the comparison. "file1byte" is + ' equal to "file2byte" at this point only if the files are + ' the same. + Return ((file1byte - file2byte) = 0) + End Function + + Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click + If p.BusinessClassScript = String.Empty Then + MsgBox("You need to select a Business Class script in the project properties") + Exit Sub + End If + + Dim ci As frmClassInfo + If DockPanel1.ActiveContent Is Nothing Then + MsgBox("There is no class currently being displayed") + Exit Sub + End If + If DockPanel1.ActiveContent.GetType Is GetType(frmClassInfo) Then + ci = DockPanel1.ActiveContent + If ci Is Nothing Then + MsgBox("Please make a business class active first") + Exit Sub + End If + Else + MsgBox("Please make a business class active first") + Exit Sub + End If + + Dim xn_db As XmlNode + Dim xn_cls As XmlNode + Dim overwrite As Boolean + + Dim clsConv As New ClassMapTypeConverter + Dim clsCollection As New ClassMapCollection + Dim cls As ClassMap + Dim att As AttributeMap + Dim assoc As Association + Dim assocEntry As AssociationEntry + Dim c As CMappedClass = ci.MappedClass + If c.SourceFile Is Nothing Then + SaveFileDialog1.FileName = "*.*" + SaveFileDialog1.AddExtension = True + SaveFileDialog1.Filter = "All Files (*.*)|*.*|VB Classes (*.vb)|*.vb|C# Classes (*.cs)|*.cs" + If SaveFileDialog1.ShowDialog(Me) = DialogResult.OK Then + c.SourceFile = SaveFileDialog1.FileName + Else + MsgBox("A file name is required") + Exit Sub + End If + End If + + cls = New ClassMap + cls.ClassName = c.ClassName + cls.SourceFile = c.SourceFile + cls.classNamespace = c.ClassNameSpace + cls.databaseName = c.DatabaseName + cls.table = c.Table + cls.tableOwner = c.TableOwner + cls.modifyOnlyFlag = c.ModifyOnlyFlag + cls.readOnlyFlag = c.ReadOnlyFlag + cls.sharedField = c.SharedField + cls.sharedValue = c.SharedValue + cls.SourceFile = c.SourceFile + cls.assemblyPath = c.AssemblyPath + cls.factory = c.Factory + cls.associations = New AssociationCollection + cls.attributes = New CodeSmithDataClasses.AttributeCollection + If Not c.SuperClass Is Nothing Then + cls.superClassName = c.SuperClass.ClassName + cls.superClassNameSpace = c.SuperClass.ClassNameSpace + End If + For Each a As CMappedAttribute In c.Attributes + att = New AttributeMap + att.column = a.Column + att.isFind = a.isFind + att.isIdentity = a.isIdentity + att.isKey = a.isKey + att.isProxy = a.isProxy + att.isTimeStamp = a.isTimeStamp + att.Name = a.Name + att.referenceToParentField = a.Reference + If Not a.MappedColumn Is Nothing Then + att.dataType = a.MappedColumn.dotnetTypeName + Else + att.dataType = a.DataType + End If + cls.attributes.Add(att) + Next + For Each ass As CMappedAssociation In c.Associations + assoc = New Association + If ass.Name <> "No Target" Then + assoc.name = ass.Name + End If + assoc.cardinality = ass.Cardinality + assoc.deleteAuto = ass.DeleteAuto + assoc.fromClass = ass.FromClassName + assoc.retrieveAuto = ass.RetrieveAuto + assoc.lazyLoad = ass.LazyLoad + assoc.saveAuto = ass.SaveAuto + assoc.target = ass.TargetAttribute.Name + assoc.toClass = ass.ToClassName + If ass.FromClassNamespace <> String.Empty Then + assoc.fromNamespace = ass.FromClassNamespace + Else + assoc.fromNamespace = ass.FromClass.ClassNameSpace + End If + If ass.ToClassNamespace <> String.Empty Then + assoc.toNamespace = ass.ToClassNamespace + Else + assoc.toNamespace = ass.ToClass.ClassNameSpace + End If + assoc.entries = New AssociationEntryCollection + For Each ent As CAssociationEntry In ass.Entries + assocEntry = New AssociationEntry + assocEntry.fromAttribute = ent.fromAttributeName + assocEntry.toAttribute = ent.toAttributeName + assoc.entries.Add(assocEntry) + Next + cls.associations.Add(assoc) + Next + clsCollection.Add(cls) + xn_cls = TypeDescriptor.GetConverter(clsCollection).ConvertTo(clsCollection, GetType(XmlNode)) + Dim xr As New System.Xml.XmlTextWriter(opt.ScriptDirectory & "\properties.xml", Nothing) + xr.WriteStartElement("codeSmith") + xr.WriteStartElement("propertySet") + xr.WriteStartElement("property") + xr.WriteAttributeString("name", "classes") + xr.WriteRaw(xn_cls.OuterXml) + xr.WriteEndElement() + xr.WriteEndElement() + xr.Close() + Dim cmdString As String + cmdString = """" & opt.CodeSmithDirectory & "\CodeSmithConsole.exe"" " + cmdString &= "/template:""" & opt.ScriptDirectory & "\" & p.BusinessClassScript & """ " + cmdString &= "/properties:""" & opt.ScriptDirectory & "\properties.xml"" " + cmdString &= "/out:""" & opt.ScriptDirectory & "\new.code""" + Shell(cmdString, AppWinStyle.NormalFocus, True) + overwrite = True + If File.Exists(c.SourceFile) Then + If Not FileCompare(opt.ScriptDirectory & "\new.code", c.SourceFile) Then + If opt.DiffUtil <> String.Empty Then + 'check new code vs original + cmdString = """" & opt.DiffUtil & """" + cmdString &= " """ & opt.ScriptDirectory & "\new.code""" + cmdString &= " """ & c.SourceFile & """" + Shell(cmdString, AppWinStyle.Hide, True) + overwrite = False + Else + If Not MsgBox("Overwrite existing file?", MsgBoxStyle.YesNo) Then + overwrite = False + End If + End If + Else + overwrite = False + End If + If overwrite Then + File.Copy(c.SourceFile, c.SourceFile & ".bak") + File.Copy(opt.ScriptDirectory & "\new.code", c.SourceFile, True) + End If + Else + File.Copy(opt.ScriptDirectory & "\new.code", c.SourceFile, False) + End If End Sub End Class Index: frmAddDatabase.vb =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/frmAddDatabase.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmAddDatabase.vb 12 Oct 2004 23:10:17 -0000 1.1 +++ frmAddDatabase.vb 10 Dec 2004 04:31:12 -0000 1.2 @@ -1,34 +1,36 @@ +Imports AFMappingClasses + Public Class frmAddDatabase - Inherits System.Windows.Forms.Form + Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " - Public Sub New() - MyBase.New() + Public Sub New() + MyBase.New() - 'This call is required by the Windows Form Designer. - InitializeComponent() + 'This call is required by the Windows Form Designer. + InitializeComponent() - 'Add any initialization after the InitializeComponent() call + 'Add any initialization after the InitializeComponent() call - End Sub + 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 + '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 + '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. + '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 ComboBox1 As System.Windows.Forms.ComboBox Friend WithEvents Label2 As System.Windows.Forms.Label @@ -217,7 +219,7 @@ Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "frmAddDatabase" - Me.Text = "Database Connection" + Me.Text = "frmAddDatabase" Me.GroupBox1.ResumeLayout(False) Me.ResumeLayout(False) @@ -282,4 +284,5 @@ lblParam3.Text = "OIDTable" End If End Sub + End Class Index: COptions.vb =================================================================== RCS file: /cvsroot/jcframework/FrameworkMapper/COptions.vb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- COptions.vb 12 Oct 2004 23:10:17 -0000 1.1 +++ COptions.vb 10 Dec 2004 04:31:12 -0000 1.2 @@ -2,19 +2,29 @@ Imports System.io Public Class COptions - Public TemplateSets As New Collection - Public CurrentTemplateSet As TemplateSet - Public TemplateDirectory As String + Public CSScripts As New Collection + Public CodeSmithDirectory As String + Private _scriptDir As String + Public DiffUtil As String + + Public Property ScriptDirectory() As String + Get + Return _scriptDir + End Get + Set(ByVal Value As String) + If _scriptD... [truncated message content] |