⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsmaster.vb

📁 东软内部材料(六)ado .net相关
💻 VB
📖 第 1 页 / 共 2 页
字号:
'------------------------------------------------------------------------------
' <autogenerated>
'     This code was generated by a tool.
'     Runtime Version: 1.0.2914.16
'
'     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
Imports System.Data
Imports System.Runtime.Serialization
Imports System.Xml


<Serializable(),  _
 System.ComponentModel.DesignerCategoryAttribute("code")>  _
Public Class dsMaster
    Inherits System.Data.DataSet
    
    Private tableCustomerList As CustomerListDataTable
    
    Private tableOrderTotals As OrderTotalsDataTable
    
    Public Sub New()
        MyBase.New
        Me.InitClass
    End Sub
    
    Private Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
        MyBase.New
        Me.InitClass
        Me.GetSerializationData(info, context)
    End Sub
    
    <System.ComponentModel.Browsable(false),  _
     System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)>  _
    Public ReadOnly Property CustomerList As CustomerListDataTable
        Get
            Return Me.tableCustomerList
        End Get
    End Property
    
    <System.ComponentModel.Browsable(false),  _
     System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)>  _
    Public ReadOnly Property OrderTotals As OrderTotalsDataTable
        Get
            Return Me.tableOrderTotals
        End Get
    End Property
    
    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.ReadXml(reader, XmlReadMode.IgnoreSchema)
    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
    
    Private Sub InitClass()
        Me.DataSetName = "dsMaster"
        Me.Namespace = "http://www.tempuri.org/dsMaster.xsd"
        Me.tableCustomerList = New CustomerListDataTable
        Me.Tables.Add(Me.tableCustomerList)
        Me.tableOrderTotals = New OrderTotalsDataTable
        Me.Tables.Add(Me.tableOrderTotals)
    End Sub
    
    Private Function ShouldSerializeCustomerList() As Boolean
        Return false
    End Function
    
    Private Function ShouldSerializeOrderTotals() As Boolean
        Return false
    End Function
    
    Public Delegate Sub CustomerListRowChangeEventHandler(ByVal sender As Object, ByVal e As CustomerListRowChangeEvent)
    
    Public Delegate Sub OrderTotalsRowChangeEventHandler(ByVal sender As Object, ByVal e As OrderTotalsRowChangeEvent)
    
    Public Class CustomerListDataTable
        Inherits DataTable
        Implements System.Collections.IEnumerable
        
        Private columnCustomerID As DataColumn
        
        Private columnCompanyName As DataColumn
        
        Private columnCity As DataColumn
        
        Private columnCountry As DataColumn
        
        Private columnPostalCode As DataColumn
        
        Private column_Region As DataColumn
        
        Friend Sub New()
            MyBase.New("CustomerList")
            Me.InitClass
        End Sub
        
        <System.ComponentModel.Browsable(false)>  _
        Public ReadOnly Property Count As Integer
            Get
                Return Me.Rows.Count
            End Get
        End Property
        
        Friend ReadOnly Property CustomerIDColumn As DataColumn
            Get
                Return Me.columnCustomerID
            End Get
        End Property
        
        Friend ReadOnly Property CompanyNameColumn As DataColumn
            Get
                Return Me.columnCompanyName
            End Get
        End Property
        
        Friend ReadOnly Property CityColumn As DataColumn
            Get
                Return Me.columnCity
            End Get
        End Property
        
        Friend ReadOnly Property CountryColumn As DataColumn
            Get
                Return Me.columnCountry
            End Get
        End Property
        
        Friend ReadOnly Property PostalCodeColumn As DataColumn
            Get
                Return Me.columnPostalCode
            End Get
        End Property
        
        Friend ReadOnly Property _RegionColumn As DataColumn
            Get
                Return Me.column_Region
            End Get
        End Property
        
        Public Default ReadOnly Property Item(ByVal index As Integer) As CustomerListRow
            Get
                Return CType(Me.Rows(index),CustomerListRow)
            End Get
        End Property
        
        Public Event CustomerListRowChanged As CustomerListRowChangeEventHandler
        
        Public Event CustomerListRowChanging As CustomerListRowChangeEventHandler
        
        Public Event CustomerListRowDeleted As CustomerListRowChangeEventHandler
        
        Public Event CustomerListRowDeleting As CustomerListRowChangeEventHandler
        
        Public Overloads Sub AddCustomerListRow(ByVal row As CustomerListRow)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddCustomerListRow(ByVal CustomerID As String, ByVal CompanyName As String, ByVal City As String, ByVal Country As String, ByVal PostalCode As String, ByVal _Region As String) As CustomerListRow
            Dim rowCustomerListRow As CustomerListRow = CType(Me.NewRow,CustomerListRow)
            rowCustomerListRow.ItemArray = New Object() {CustomerID, CompanyName, City, Country, PostalCode, _Region}
            Me.Rows.Add(rowCustomerListRow)
            Return rowCustomerListRow
        End Function
        
        Public Function FindByCustomerID(ByVal CustomerID As String) As CustomerListRow
            Return CType(Me.Rows.Find(New Object() {CustomerID}),CustomerListRow)
        End Function
        
        Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
            Return Me.Rows.GetEnumerator
        End Function
        
        Private Sub InitClass()
            Me.columnCustomerID = New DataColumn("CustomerID", GetType(System.String), "", System.Data.MappingType.Element)
            Me.columnCustomerID.AllowDBNull = false
            Me.columnCustomerID.Unique = true
            Me.Columns.Add(Me.columnCustomerID)
            Me.columnCompanyName = New DataColumn("CompanyName", GetType(System.String), "", System.Data.MappingType.Element)
            Me.columnCompanyName.AllowDBNull = false
            Me.Columns.Add(Me.columnCompanyName)
            Me.columnCity = New DataColumn("City", GetType(System.String), "", System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCity)
            Me.columnCountry = New DataColumn("Country", GetType(System.String), "", System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCountry)
            Me.columnPostalCode = New DataColumn("PostalCode", GetType(System.String), "", System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnPostalCode)
            Me.column_Region = New DataColumn("Region", GetType(System.String), "", System.Data.MappingType.Element)
            Me.Columns.Add(Me.column_Region)
            Me.PrimaryKey = New DataColumn() {Me.columnCustomerID}
        End Sub
        
        Public Function NewCustomerListRow() As CustomerListRow
            Return CType(Me.NewRow,CustomerListRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            'We need to ensure that all Rows in the tabled are typed rows.
            'Table calls newRow whenever it needs to create a row.
            'So the following conditions are covered by Row newRow(Record record)
            '* Cursor calls table.addRecord(record) 
            '* table.addRow(object[] values) calls newRow(record)    
            Return New CustomerListRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(CustomerListRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.CustomerListRowChangedEvent) Is Nothing) Then
                RaiseEvent CustomerListRowChanged(Me, New CustomerListRowChangeEvent(CType(e.Row,CustomerListRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.CustomerListRowChangingEvent) Is Nothing) Then
                RaiseEvent CustomerListRowChanging(Me, New CustomerListRowChangeEvent(CType(e.Row,CustomerListRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.CustomerListRowDeletedEvent) Is Nothing) Then
                RaiseEvent CustomerListRowDeleted(Me, New CustomerListRowChangeEvent(CType(e.Row,CustomerListRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.CustomerListRowDeletingEvent) Is Nothing) Then
                RaiseEvent CustomerListRowDeleting(Me, New CustomerListRowChangeEvent(CType(e.Row,CustomerListRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveCustomerListRow(ByVal row As CustomerListRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    Public Class CustomerListRow
        Inherits DataRow
        
        Private tableCustomerList As CustomerListDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableCustomerList = CType(Me.Table,CustomerListDataTable)
        End Sub
        
        Public Property CustomerID As String
            Get
                Return CType(Me(Me.tableCustomerList.CustomerIDColumn),String)
            End Get
            Set
                Me(Me.tableCustomerList.CustomerIDColumn) = value
            End Set
        End Property
        
        Public Property CompanyName As String
            Get
                Return CType(Me(Me.tableCustomerList.CompanyNameColumn),String)
            End Get
            Set
                Me(Me.tableCustomerList.CompanyNameColumn) = value
            End Set
        End Property
        
        Public Property City As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomerList.CityColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomerList.CityColumn) = value
            End Set
        End Property
        
        Public Property Country As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomerList.CountryColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomerList.CountryColumn) = value
            End Set
        End Property
        
        Public Property PostalCode As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomerList.PostalCodeColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomerList.PostalCodeColumn) = value
            End Set
        End Property
        
        Public Property _Region As String
            Get
                Try 
                    Return CType(Me(Me.tableCustomerList._RegionColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableCustomerList._RegionColumn) = value
            End Set
        End Property

⌨️ 快捷键说明

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