northwinddataset.designer.vb

来自「wrox出版社的另一套经典的VB2005数据库编程学习书籍,收集了书中源码,郑重」· VB 代码 · 共 1,373 行 · 第 1/5 页

VB
1,373
字号
'------------------------------------------------------------------------------
' <autogenerated>
'     This code was generated by a tool.
'     Runtime Version:2.0.40607.42
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System


<Serializable(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.ComponentModel.ToolboxItem(true),  _
 System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema"),  _
 System.Xml.Serialization.XmlRootAttribute("NorthwindDataSet")>  _
Partial Public Class NorthwindDataSet
    Inherits System.Data.DataSet
    
    Private tableProducts As ProductsDataTable
    
    Private tableSuppliers As SuppliersDataTable
    
    Public Sub New()
        MyBase.New
        Me.BeginInit
        Me.InitClass
        Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
        AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler
        AddHandler MyBase.Relations.CollectionChanged, schemaChangedHandler
        Me.EndInit
    End Sub
    
    Protected Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
        MyBase.New(info, context)
        If (Me.IsBinarySerialized(info, context) = true) Then
            Me.InitVars(false)
            Dim schemaChangedHandler1 As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
            AddHandler Me.Tables.CollectionChanged, schemaChangedHandler1
            AddHandler Me.Relations.CollectionChanged, schemaChangedHandler1
            Return
        End If
        Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(String)),String)
        If (Not (strSchema) Is Nothing) Then
            Dim ds As System.Data.DataSet = New System.Data.DataSet
            ds.ReadXmlSchema(New System.Xml.XmlTextReader(New System.IO.StringReader(strSchema)))
            If (Not (ds.Tables("Products")) Is Nothing) Then
                MyBase.Tables.Add(New ProductsDataTable(ds.Tables("Products")))
            End If
            If (Not (ds.Tables("Suppliers")) Is Nothing) Then
                MyBase.Tables.Add(New SuppliersDataTable(ds.Tables("Suppliers")))
            End If
            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.BeginInit
            Me.InitClass
            Me.EndInit
        End If
        Me.GetSerializationData(info, context)
        Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
        AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler
        AddHandler Me.Relations.CollectionChanged, schemaChangedHandler
    End Sub
    
    <System.ComponentModel.Browsable(false),  _
     System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>  _
    Public ReadOnly Property Products() As ProductsDataTable
        Get
            Return Me.tableProducts
        End Get
    End Property
    
    <System.ComponentModel.Browsable(false),  _
     System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>  _
    Public ReadOnly Property Suppliers() As SuppliersDataTable
        Get
            Return Me.tableSuppliers
        End Get
    End Property
    
    <System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public Shadows ReadOnly Property Tables() As System.Data.DataTableCollection
        Get
            Return MyBase.Tables
        End Get
    End Property
    
    <System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)>  _
    Public Shadows ReadOnly Property Relations() As System.Data.DataRelationCollection
        Get
            Return MyBase.Relations
        End Get
    End Property
    
    <System.ComponentModel.DefaultValueAttribute(false)>  _
    Public Shadows Property EnforceConstraints() As Boolean
        Get
            Return MyBase.EnforceConstraints
        End Get
        Set
            MyBase.EnforceConstraints = value
        End Set
    End Property
    
    Public Overrides Function Clone() As System.Data.DataSet
        Dim cln As NorthwindDataSet = CType(MyBase.Clone,NorthwindDataSet)
        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 System.Xml.XmlReader)
        Me.Reset
        Dim ds As System.Data.DataSet = New System.Data.DataSet
        ds.ReadXml(reader)
        If (Not (ds.Tables("Products")) Is Nothing) Then
            MyBase.Tables.Add(New ProductsDataTable(ds.Tables("Products")))
        End If
        If (Not (ds.Tables("Suppliers")) Is Nothing) Then
            MyBase.Tables.Add(New SuppliersDataTable(ds.Tables("Suppliers")))
        End If
        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 System.Xml.XmlTextWriter(stream, Nothing))
        stream.Position = 0
        Return System.Xml.Schema.XmlSchema.Read(New System.Xml.XmlTextReader(stream), Nothing)
    End Function
    
    Friend Overloads Sub InitVars()
        Me.InitVars(true)
    End Sub
    
    Friend Overloads Sub InitVars(ByVal initTable As Boolean)
        Me.tableProducts = CType(MyBase.Tables("Products"),ProductsDataTable)
        If (initTable = true) Then
            If (Not (Me.tableProducts) Is Nothing) Then
                Me.tableProducts.InitVars
            End If
        End If
        Me.tableSuppliers = CType(MyBase.Tables("Suppliers"),SuppliersDataTable)
        If (initTable = true) Then
            If (Not (Me.tableSuppliers) Is Nothing) Then
                Me.tableSuppliers.InitVars
            End If
        End If
    End Sub
    
    Private Sub InitClass()
        Me.DataSetName = "NorthwindDataSet"
        Me.Prefix = ""
        Me.Namespace = "http://tempuri.org/NorthwindDataSet.xsd"
        Me.Locale = New System.Globalization.CultureInfo("en-US")
        Me.CaseSensitive = false
        Me.EnforceConstraints = false
        Me.tableProducts = New ProductsDataTable
        MyBase.Tables.Add(Me.tableProducts)
        Me.tableSuppliers = New SuppliersDataTable
        MyBase.Tables.Add(Me.tableSuppliers)
        Me.ExtendedProperties.Add("DSGenerator_DataSetName", "NorthwindDataSet")
        Me.ExtendedProperties.Add("User_DataSetName", "NorthwindDataSet")
    End Sub
    
    Private Function ShouldSerializeProducts() As Boolean
        Return false
    End Function
    
    Private Function ShouldSerializeSuppliers() As Boolean
        Return false
    End Function
    
    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
    
    Public Shared Function GetTypedDataSetSchema(ByVal xs As System.Xml.Schema.XmlSchemaSet) As System.Xml.Schema.XmlSchemaComplexType
        Dim ds As NorthwindDataSet = New NorthwindDataSet
        Dim type As System.Xml.Schema.XmlSchemaComplexType = New System.Xml.Schema.XmlSchemaComplexType
        Dim sequence As System.Xml.Schema.XmlSchemaSequence = New System.Xml.Schema.XmlSchemaSequence
        xs.Add(ds.GetSchemaSerializable)
        If PublishLegacyWSDL Then
            Dim any As System.Xml.Schema.XmlSchemaAny = New System.Xml.Schema.XmlSchemaAny
            any.Namespace = ds.Namespace
            sequence.Items.Add(any)
        Else
            Dim any1 As System.Xml.Schema.XmlSchemaAny = New System.Xml.Schema.XmlSchemaAny
            any1.Namespace = "http://www.w3.org/2001/XMLSchema"
            any1.MinOccurs = New Decimal(0)
            any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax
            sequence.Items.Add(any1)
            Dim any2 As System.Xml.Schema.XmlSchemaAny = New System.Xml.Schema.XmlSchemaAny
            any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"
            any2.MinOccurs = New Decimal(0)
            any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax
            sequence.Items.Add(any2)
            sequence.MaxOccurs = Decimal.MaxValue
            Dim attribute As System.Xml.Schema.XmlSchemaAttribute = New System.Xml.Schema.XmlSchemaAttribute
            attribute.Name = "namespace"
            attribute.FixedValue = ds.Namespace
            type.Attributes.Add(attribute)
        End If
        type.Particle = sequence
        Return type
    End Function
    
    Protected Shared Function PublishLegacyWSDL() As Boolean
        Dim settings As System.Collections.Specialized.NameValueCollection = CType(System.Configuration.ConfigurationSettings.GetConfig("system.data.dataset"),System.Collections.Specialized.NameValueCollection)
        If (Not (settings) Is Nothing) Then
            Dim values() As String = settings.GetValues("WSDL_VERSION")
            If (Not (values) Is Nothing) Then
                Dim version As Single = Single.Parse(CType(values(0),String), CType(Nothing,System.IFormatProvider))
                Return (version < 2)
            End If
        End If
        Return true
    End Function
    
    Public Delegate Sub ProductsRowChangeEventHandler(ByVal sender As Object, ByVal e As ProductsRowChangeEvent)
    
    Public Delegate Sub SuppliersRowChangeEventHandler(ByVal sender As Object, ByVal e As SuppliersRowChangeEvent)
    
    <System.Serializable(),  _
     System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")>  _
    Partial Public Class ProductsDataTable
        Inherits System.Data.DataTable
        Implements System.Collections.IEnumerable
        
        Private columnProductID As System.Data.DataColumn
        
        Private columnProductName As System.Data.DataColumn
        
        Private columnSupplierID As System.Data.DataColumn
        
        Private columnCategoryID As System.Data.DataColumn
        
        Private columnQuantityPerUnit As System.Data.DataColumn
        
        Private columnUnitPrice As System.Data.DataColumn
        
        Private columnUnitsInStock As System.Data.DataColumn
        
        Private columnUnitsOnOrder As System.Data.DataColumn
        
        Private columnReorderLevel As System.Data.DataColumn
        

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?