A.3 Typisiertes DataSet 

Das unten abgedruckte stark typisierte DataSet beschreibt einen Ausschnitt aus der Northwind-Datenbank. Aus der Tabelle Products sind die Spalten ProductID, ProductName, CategoryID und UnitPrice vertreten; aus Categories sind es CategoryID und CategoryName. Um das Listing abzukürzen, wurden einige Namensräume importiert und ein paar Schlüsselwörter abgekürzt. Das Listing hat nicht an allen Stellen dieselbe Reihenfolge wie die vom Designer des Visual Studios erzeugte Datei.
Zeichen | Bedeutung |
+ |
Public |
# |
Protected |
= |
Friend |
- |
Private |
* |
Overridable |
& |
Overloads |
O |
Overrides |
S |
Shadows |
P |
Partial |
% |
Shared |
Imports System.Data
Imports System.Runtime.Serialization
Imports System.Xml
Imports System.Xml.Schema
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Option Strict Off
Option Explicit On
+P Class NWDataSet : Inherits DataSet
+ Sub New()
# Sub New(info As SerializationInfo, context As StreamingContext)
#O Sub InitializeDerivedDataSet()
=& Sub InitVars()
=& Sub InitVars(initTable As Boolean)
+O Function Clone() As DataSet
+ ReadOnly Property Products() As ProductsDataTable
+ ReadOnly Property Categories() As CategoriesDataTable
+S ReadOnly Property Tables() As DataTableCollection
+S ReadOnly Property Relations() As DataRelationCollection
+O Property SchemaSerializationMode() As SchemaSerializationMode
#O Function ShouldSerializeTables() As Boolean
#O Function ShouldSerializeRelations() As Boolean
#O Sub ReadXmlSerializable(reader As XmlReader)
#O Function GetSchemaSerializable() As XmlSchema
+ Shared Function GetTypedDataSetSchema(xs As XmlSchemaSet) _
As XmlSchemaComplexType
+ Delegate Sub ProductsRowChangeEventHandler _
(sender As Object, e As ProductsRowChangeEvent)
+ Delegate Sub CategoriesRowChangeEventHandler _
(sender As Object, e As CategoriesRowChangeEvent)
+P Class ProductsDataTable : Inherits TypedTableBase(Of ProductsRow)
+ Sub New()
= Sub New(table As DataTable)
# Sub New(info As SerializationInfo, context As StreamingContext)
#O Function CreateInstance() As DataTable
= Sub InitVars()
+O Function Clone() As DataTable
+ ReadOnly Property ProductIDColumn() As DataColumn
+ ReadOnly Property ProductNameColumn() As DataColumn
+ ReadOnly Property CategoryIDColumn() As DataColumn
+ ReadOnly Property UnitPriceColumn() As DataColumn
+ ReadOnly Property Count() As Integer
+ Default ReadOnly Property Item(index As Integer) As ProductsRow
+ Event ProductsRowChanging As ProductsRowChangeEventHandler
+ Event ProductsRowChanged As ProductsRowChangeEventHandler
+ Event ProductsRowDeleting As ProductsRowChangeEventHandler
+ Event ProductsRowDeleted As ProductsRowChangeEventHandler
#O Sub OnRowChanged(e As DataRowChangeEventArgs)
#O Sub OnRowChanging(e As DataRowChangeEventArgs)
#O Sub OnRowDeleted(e As DataRowChangeEventArgs)
#O Sub OnRowDeleting(e As DataRowChangeEventArgs)
#O Function GetRowType() As Type
+ Function NewProductsRow() As ProductsRow
+& Sub AddProductsRow(row As ProductsRow)
+& Function AddProductsRow(ProductName As String, _
parentCategoriesRowByFK_Products_Categories1 As CategoriesRow, _
UnitPrice As Decimal) As ProductsRow
+ Function FindByProductID(ProductID As Integer) As ProductsRow
#O Function NewRowFromBuilder(builder As DataRowBuilder) As DataRow
+ Sub RemoveProductsRow(row As ProductsRow)
+ Shared Function GetTypedTableSchema(xs As XmlSchemaSet) _
As XmlSchemaComplexType
End Class
+P Class CategoriesDataTable : Inherits TypedTableBase(Of CategoriesRow)
+ Sub New()
= Sub New(table As DataTable)
# Sub New(info As SerializationInfo, context As StreamingContext)
#O Function CreateInstance() As DataTable
= Sub InitVars()
+O Function Clone() As DataTable
+ ReadOnly Property CategoryIDColumn() As DataColumn
+ ReadOnly Property CategoryNameColumn() As DataColumn
+ ReadOnly Property Count() As Integer
+ Default ReadOnly Property Item(index As Integer) As CategoriesRow
+ Event CategoriesRowChanging As CategoriesRowChangeEventHandler
+ Event CategoriesRowChanged As CategoriesRowChangeEventHandler
+ Event CategoriesRowDeleting As CategoriesRowChangeEventHandler
+ Event CategoriesRowDeleted As CategoriesRowChangeEventHandler
#O Sub OnRowChanged(e As DataRowChangeEventArgs)
#O Sub OnRowChanging(e As DataRowChangeEventArgs)
#O Sub OnRowDeleted(e As DataRowChangeEventArgs)
#O Sub OnRowDeleting(e As DataRowChangeEventArgs)
#O Function GetRowType() As Type
+ Function NewCategoriesRow() As CategoriesRow
+& Sub AddCategoriesRow(row As CategoriesRow)
+& Function AddCategoriesRow(CategoryName As String) As CategoriesRow
+ Function FindByCategoryID(CategoryID As Integer) As CategoriesRow
#O Function NewRowFromBuilder(builder As DataRowBuilder) As DataRow
+ Sub RemoveCategoriesRow(row As CategoriesRow)
+ Shared Function GetTypedTableSchema(xs As XmlSchemaSet) _
As XmlSchemaComplexType
End Class
+P Class ProductsRow : Inherits DataRow
= Sub New(rb As DataRowBuilder)
+ Property ProductID() As Integer
+ Property ProductName() As String
+ Property CategoryID() As Integer
+ Property UnitPrice() As Decimal
+ Property CategoriesRow() As CategoriesRow
+ Function IsCategoryIDNull() As Boolean
+ Sub SetCategoryIDNull()
+ Function IsUnitPriceNull() As Boolean
+ Sub SetUnitPriceNull()
End Class
+P Class CategoriesRow : Inherits DataRow
= Sub New(rb As DataRowBuilder)
+ Property CategoryID() As Integer
+ Property CategoryName() As String
+ Function GetProductsRows() As ProductsRow()
End Class
+ Class ProductsRowChangeEvent : Inherits EventArgs
+ Sub New(row As ProductsRow, action As DataRowAction)
+ ReadOnly Property Row() As ProductsRow
+ ReadOnly Property Action() As DataRowAction
End Class
+ Class CategoriesRowChangeEvent : Inherits EventArgs
+ Sub New(row As CategoriesRow, action As DataRowAction)
+ ReadOnly Property Row() As CategoriesRow
+ ReadOnly Property Action() As DataRowAction
End Class
End Class
Namespace NWDataSetTableAdapters
+P Class ProductsTableAdapter : Inherits Component
+ Sub New()
+ Property ClearBeforeFill() As Boolean
+&* Function Fill(dataTable As NWDataSet.ProductsDataTable) As Integer
+&* Function GetData() As NWDataSet.ProductsDataTable
#= ReadOnly Property Adapter() As SqlClient.SqlDataAdapter
= Property Connection() As SqlClient.SqlConnection
= Property Transaction() As SqlClient.SqlTransaction
# ReadOnly Property CommandCollection() As SqlClient.SqlCommand()
+&* Function Update(dataTable As NWDataSet.ProductsDataTable) As Integer
+&* Function Update(dataSet As NWDataSet) As Integer
+&* Function Update(dataRow As DataRow) As Integer
+&* Function Update(dataRows() As DataRow) As Integer
+&* Function Update(ProductName As String, CategoryID As Integer?, _
UnitPrice As Decimal?, Original_ProductID As Integer, _
Original_ProductName As String, Original_CategoryID As Integer?, _
Original_UnitPrice As GDecimal?, ProductID As Integer) As Integer
+&* Function Update(ProductName As String, CategoryID As Integer?, _
UnitPrice As Decimal?, Original_ProductID As Integer, _
Original_ProductName As String, Original_CategoryID As Integer?, _
Original_UnitPrice As Decimal?) As Integer
+&* Function Insert(ProductName As String, CategoryID As Integer?, _
UnitPrice As Decimal?) As Integer
+&* Function Delete(Original_ProductID As Integer, _
Original_ProductName As String, Original_CategoryID As Integer?, _
Original_UnitPrice As Decimal?) As Integer
End Class
+P Class CategoriesTableAdapter : Inherits Component
+ Sub New()
+ Property ClearBeforeFill() As Boolean
+&* Function Fill(dataTable As NWDataSet.CategoriesDataTable) As Integer
+&* Function GetData() As NWDataSet.CategoriesDataTable
#= ReadOnly Property Adapter() As SqlClient.SqlDataAdapter
= Property Connection() As SqlClient.SqlConnection
= Property Transaction() As SqlClient.SqlTransaction
# ReadOnly Property CommandCollection() As SqlClient.SqlCommand()
+&* Function Update(dataTable As NWDataSet.CategoriesDataTable) As Integer
+&* Function Update(dataSet As NWDataSet) As Integer
+&* Function Update(dataRow As DataRow) As Integer
+&* Function Update(dataRows() As DataRow) As Integer
+&* Function Update(CategoryName As String, _
Original_CategoryID As Integer, Original_CategoryName As String, _
CategoryID As Integer) As Integer
+&* Function Update(CategoryName As String, _
Original_CategoryID As Integer, Original_CategoryName As String) _
As Integer
+&* Function Insert(CategoryName As String) As Integer
+&* Function Delete(Original_CategoryID As Integer, _
Original_CategoryName As String) As Integer
End Class
+P Class TableAdapterManager : Inherits Component
+ Property ProductsTableAdapter() As ProductsTableAdapter
+ Property CategoriesTableAdapter() As CategoriesTableAdapter
+ ReadOnly Property TableAdapterInstanceCount() As Integer
+ Property Connection() As IDbConnection
#* Function MatchTableAdapterConnection _
(inputConnection As IDbConnection) As Boolean
+ Property UpdateOrder() As UpdateOrderOption
+ Enum UpdateOrderOption
+ Property BackupDataSetBeforeUpdate() As Boolean
+* Function UpdateAll(dataSet As NWDataSet) As Integer
#* Sub SortSelfReferenceRows(rows() As DataRow, _
relation As DataRelation, childFirst As Boolean)
End Class
End Namespace
Ihre Meinung
Wie hat Ihnen das Openbook gefallen? Wir freuen uns immer über Ihre Rückmeldung. Schreiben Sie uns gerne Ihr Feedback als E-Mail an kommunikation@rheinwerk-verlag.de.