@ tefigel ############################################################################# # # Main Tefigel macro to generate VB.NET code using list_process # ############################################################################# set CUR_TABLE_LIST=~list_contents(CUR_DATASET) set CUR_RELATION_LIST=~list_contents(CUR_RELATIONS) @ text '------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version: 1.0.3705.209 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict Off Option Explicit On Imports System Imports System.Data Imports System.Runtime.Serialization Imports System.Xml _ Public Class CUR_DATASET Inherits DataSet @ for METATABLE=CUR_TABLE_LIST Private table&METATABLE As METATABLE&DataTable @ endfor @ @ for METARELATION=CUR_RELATION_LIST Private relation&MetaRelInfo(METARELATION,id) As DataRelation @ endfor Public Sub New() MyBase.New Me.InitClass Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged AddHandler Me.Tables.CollectionChanged, schemaChangedHandler AddHandler Me.Relations.CollectionChanged, schemaChangedHandler End Sub Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) MyBase.New Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String) If (Not (strSchema) Is Nothing) Then Dim ds As DataSet = New DataSet ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema))) @ for METATABLE=CUR_TABLE_LIST If (Not (ds.Tables("METATABLE")) Is Nothing) Then Me.Tables.Add(New METATABLE&DataTable(ds.Tables("METATABLE"))) End If @ endfor Me.DataSetName = ds.DataSetName Me.Prefix = ds.Prefix Me.Namespace = ds.Namespace Me.Locale = ds.Locale Me.CaseSensitive = ds.CaseSensitive Me.EnforceConstraints = ds.EnforceConstraints Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) Me.InitVars Else Me.InitClass End If Me.GetSerializationData(info, context) Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged AddHandler Me.Tables.CollectionChanged, schemaChangedHandler AddHandler Me.Relations.CollectionChanged, schemaChangedHandler End Sub @ for METATABLE=CUR_TABLE_LIST _ Public ReadOnly Property METATABLE As METATABLE&DataTable Get Return Me.table&METATABLE End Get End Property @ endfor Public Overrides Function Clone() As DataSet Dim cln As CUR_DATASET = CType(MyBase.Clone,CUR_DATASET) cln.InitVars Return cln End Function Protected Overrides Function ShouldSerializeTables() As Boolean Return false End Function Protected Overrides Function ShouldSerializeRelations() As Boolean Return false End Function Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader) Me.Reset Dim ds As DataSet = New DataSet ds.ReadXml(reader) @ for METATABLE=CUR_TABLE_LIST If (Not (ds.Tables("METATABLE")) Is Nothing) Then Me.Tables.Add(New METATABLE&DataTable(ds.Tables("METATABLE"))) End If @ endfor Me.DataSetName = ds.DataSetName Me.Prefix = ds.Prefix Me.Namespace = ds.Namespace Me.Locale = ds.Locale Me.CaseSensitive = ds.CaseSensitive Me.EnforceConstraints = ds.EnforceConstraints Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) Me.InitVars End Sub Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing)) stream.Position = 0 Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing) End Function Friend Sub InitVars() @ for METATABLE=CUR_TABLE_LIST Me.table&METATABLE = CType(Me.Tables("METATABLE"),METATABLE&DataTable) If (Not (Me.table&METATABLE) Is Nothing) Then Me.table&METATABLE.InitVars End If @ endfor @ @ for METARELATION=CUR_RELATION_LIST @ set RELATION_ID=MetaRelInfo(METARELATION,id) Me.relation&RELATION_ID = Me.Relations("RELATION_ID") @ endfor End Sub Private Sub InitClass() Me.DataSetName = "CUR_DATASET" Me.Prefix = "" Me.Namespace = "http://tempuri.org/CUR_DATASET.xsd" Me.Locale = New System.Globalization.CultureInfo("en-US") Me.CaseSensitive = false Me.EnforceConstraints = true @ for METATABLE=CUR_TABLE_LIST Me.table&METATABLE = New METATABLE&DataTable Me.Tables.Add(Me.table&METATABLE) @ endfor Dim fkc As ForeignKeyConstraint @ for METARELATION=CUR_RELATION_LIST @ set RELATION_ID=MetaRelInfo(METARELATION,id) @ set P_TABLE=MetaRelInfo(METARELATION,parent_table) @ set P_KEY=MetaRelInfo(METARELATION,parent_key) @ set C_TABLE=MetaRelInfo(METARELATION,child_table) @ set C_KEY=MetaRelInfo(METARELATION,child_key) fkc = New ForeignKeyConstraint("RELATION_ID", New DataColumn() {Me.table&P_TABLE.P_KEY&Column}, New DataColumn() {Me.table&C_TABLE.C_KEY&Column}) Me.table&C_TABLE.Constraints.Add(fkc) fkc.AcceptRejectRule = AcceptRejectRule.None fkc.DeleteRule = Rule.Cascade fkc.UpdateRule = Rule.Cascade @ endfor @ @ for METARELATION=CUR_RELATION_LIST @ set RELATION_ID=MetaRelInfo(METARELATION,id) @ set P_TABLE=MetaRelInfo(METARELATION,parent_table) @ set P_KEY=MetaRelInfo(METARELATION,parent_key) @ set C_TABLE=MetaRelInfo(METARELATION,child_table) @ set C_KEY=MetaRelInfo(METARELATION,child_key) Me.relation&RELATION_ID = New DataRelation("RELATION_ID", New DataColumn() {Me.table&P_TABLE.P_KEY&Column}, New DataColumn() {Me.table&C_TABLE.P_KEY&Column}, false) Me.Relations.Add(Me.relation&RELATION_ID) @ endfor End Sub @ for METATABLE=CUR_TABLE_LIST Private Function ShouldSerialize&METATABLE() As Boolean Return false End Function @ endfor Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs) If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then Me.InitVars End If End Sub @ for METATABLE=CUR_TABLE_LIST Public Delegate Sub METATABLE&RowChangeEventHandler(ByVal sender As Object, ByVal e As METATABLE&RowChangeEvent) @ endfor @ @ list_process(CUR_DATASET,templates/datatable_class) @ End Class