appdatabasedataset.designer.vb

来自「清华大学出版社出版的 移动应用开发宝典 张大威(2008)的附书源代码」· VB 代码 · 共 1,416 行 · 第 1/5 页

VB
1,416
字号
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function FindByProductId(ByVal ProductId As Integer) As ProductsRow
            Return CType(Me.Rows.Find(New Object() {ProductId}),ProductsRow)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Overridable Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
            Return Me.Rows.GetEnumerator
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Overrides Function Clone() As System.Data.DataTable
            Dim cln As ProductsDataTable = CType(MyBase.Clone,ProductsDataTable)
            cln.InitVars
            Return cln
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected Overrides Function CreateInstance() As System.Data.DataTable
            Return New ProductsDataTable
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Friend Sub InitVars()
            Me.columnProductId = MyBase.Columns("ProductId")
            Me.columnProductName = MyBase.Columns("ProductName")
            Me.columnPrice = MyBase.Columns("Price")
            Me.columnDescription = MyBase.Columns("Description")
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitClass()
            Me.columnProductId = New System.Data.DataColumn("ProductId", GetType(Integer), Nothing, System.Data.MappingType.Element)
            MyBase.Columns.Add(Me.columnProductId)
            Me.columnProductName = New System.Data.DataColumn("ProductName", GetType(String), Nothing, System.Data.MappingType.Element)
            MyBase.Columns.Add(Me.columnProductName)
            Me.columnPrice = New System.Data.DataColumn("Price", GetType(Decimal), Nothing, System.Data.MappingType.Element)
            MyBase.Columns.Add(Me.columnPrice)
            Me.columnDescription = New System.Data.DataColumn("Description", GetType(String), Nothing, System.Data.MappingType.Element)
            MyBase.Columns.Add(Me.columnDescription)
            Me.Constraints.Add(New System.Data.UniqueConstraint("Constraint1", New System.Data.DataColumn() {Me.columnProductId}, true))
            Me.columnProductId.AutoIncrement = true
            Me.columnProductId.AllowDBNull = false
            Me.columnProductId.ReadOnly = true
            Me.columnProductId.Unique = true
            Me.columnProductName.AllowDBNull = false
            Me.columnProductName.MaxLength = 100
            Me.columnPrice.AllowDBNull = false
            Me.columnDescription.MaxLength = 100
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function NewProductsRow() As ProductsRow
            Return CType(Me.NewRow,ProductsRow)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected Overrides Function NewRowFromBuilder(ByVal builder As System.Data.DataRowBuilder) As System.Data.DataRow
            Return New ProductsRow(builder)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(ProductsRow)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected Overrides Sub OnRowChanged(ByVal e As System.Data.DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.ProductsRowChangedEvent) Is Nothing) Then
                RaiseEvent ProductsRowChanged(Me, New ProductsRowChangeEvent(CType(e.Row,ProductsRow), e.Action))
            End If
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected Overrides Sub OnRowChanging(ByVal e As System.Data.DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.ProductsRowChangingEvent) Is Nothing) Then
                RaiseEvent ProductsRowChanging(Me, New ProductsRowChangeEvent(CType(e.Row,ProductsRow), e.Action))
            End If
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected Overrides Sub OnRowDeleted(ByVal e As System.Data.DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.ProductsRowDeletedEvent) Is Nothing) Then
                RaiseEvent ProductsRowDeleted(Me, New ProductsRowChangeEvent(CType(e.Row,ProductsRow), e.Action))
            End If
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected Overrides Sub OnRowDeleting(ByVal e As System.Data.DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.ProductsRowDeletingEvent) Is Nothing) Then
                RaiseEvent ProductsRowDeleting(Me, New ProductsRowChangeEvent(CType(e.Row,ProductsRow), e.Action))
            End If
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub RemoveProductsRow(ByVal row As ProductsRow)
            Me.Rows.Remove(row)
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Shared Function GetTypedTableSchema(ByVal xs As System.Xml.Schema.XmlSchemaSet) As System.Xml.Schema.XmlSchemaComplexType
            Dim type As System.Xml.Schema.XmlSchemaComplexType = New System.Xml.Schema.XmlSchemaComplexType
            Dim sequence As System.Xml.Schema.XmlSchemaSequence = New System.Xml.Schema.XmlSchemaSequence
            Dim ds As AppDatabaseDataSet = New AppDatabaseDataSet
            xs.Add(ds.GetSchemaSerializable)
            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.MaxOccurs = Decimal.MaxValue
            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(1)
            any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax
            sequence.Items.Add(any2)
            Dim attribute1 As System.Xml.Schema.XmlSchemaAttribute = New System.Xml.Schema.XmlSchemaAttribute
            attribute1.Name = "namespace"
            attribute1.FixedValue = ds.Namespace
            type.Attributes.Add(attribute1)
            Dim attribute2 As System.Xml.Schema.XmlSchemaAttribute = New System.Xml.Schema.XmlSchemaAttribute
            attribute2.Name = "tableTypeName"
            attribute2.FixedValue = "ProductsDataTable"
            type.Attributes.Add(attribute2)
            type.Particle = sequence
            Return type
        End Function
    End Class
    
    Partial Public Class OrdersRow
        Inherits System.Data.DataRow
        
        Private tableOrders As OrdersDataTable
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Friend Sub New(ByVal rb As System.Data.DataRowBuilder)
            MyBase.New(rb)
            Me.tableOrders = CType(Me.Table,OrdersDataTable)
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property OrderId() As Integer
            Get
                Return CType(Me(Me.tableOrders.OrderIdColumn),Integer)
            End Get
            Set
                Me(Me.tableOrders.OrderIdColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ServerOrderId() As Integer
            Get
                Try 
                    Return CType(Me(Me.tableOrders.ServerOrderIdColumn),Integer)
                Catch e As System.InvalidCastException
                    Throw New System.Data.StrongTypingException("The value for column 'ServerOrderId' in table 'Orders' is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableOrders.ServerOrderIdColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ProductId() As Integer
            Get
                Try 
                    Return CType(Me(Me.tableOrders.ProductIdColumn),Integer)
                Catch e As System.InvalidCastException
                    Throw New System.Data.StrongTypingException("The value for column 'ProductId' in table 'Orders' is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableOrders.ProductIdColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property Quantity() As Integer
            Get
                Try 
                    Return CType(Me(Me.tableOrders.QuantityColumn),Integer)
                Catch e As System.InvalidCastException
                    Throw New System.Data.StrongTypingException("The value for column 'Quantity' in table 'Orders' is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableOrders.QuantityColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ProductName() As String
            Get
                Try 
                    Return CType(Me(Me.tableOrders.ProductNameColumn),String)
                Catch e As System.InvalidCastException
                    Throw New System.Data.StrongTypingException("The value for column 'ProductName' in table 'Orders' is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableOrders.ProductNameColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property Price() As Decimal
            Get
                Try 
                    Return CType(Me(Me.tableOrders.PriceColumn),Decimal)
                Catch e As System.InvalidCastException
                    Throw New System.Data.StrongTypingException("The value for column 'Price' in table 'Orders' is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableOrders.PriceColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function IsServerOrderIdNull() As Boolean
            Return Me.IsNull(Me.tableOrders.ServerOrderIdColumn)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub SetServerOrderIdNull()
            Me(Me.tableOrders.ServerOrderIdColumn) = System.Convert.DBNull
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function IsProductIdNull() As Boolean
            Return Me.IsNull(Me.tableOrders.ProductIdColumn)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub SetProductIdNull()
            Me(Me.tableOrders.ProductIdColumn) = System.Convert.DBNull
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function IsQuantityNull() As Boolean
            Return Me.IsNull(Me.tableOrders.QuantityColumn)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub SetQuantityNull()
            Me(Me.tableOrders.QuantityColumn) = System.Convert.DBNull
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function IsProductNameNull() As Boolean
            Return Me.IsNull(Me.tableOrders.ProductNameColumn)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub SetProductNameNull()
            Me(Me.tableOrders.ProductNameColumn) = System.Convert.DBNull
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function IsPriceNull() As Boolean
            Return Me.IsNull(Me.tableOrders.PriceColumn)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub SetPriceNull()
            Me(Me.tableOrders.PriceColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    Partial Public Class ProductsRow
        Inherits System.Data.DataRow
        
        Private tableProducts As ProductsDataTable
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Friend Sub New(ByVal rb As System.Data.DataRowBuilder)
            MyBase.New(rb)
            Me.tableProducts = CType(Me.Table,ProductsDataTable)

⌨️ 快捷键说明

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