水如烟

                 顺其自然,水到渠成 LzmTW

文或代码皆是面向初学者.我是爱好者,也是初学者.那些"文章",只按自己理解写,我是不知术语名词的.所以只供参考,也仅供参考.

导航

标记法定义和创建数据库(四)

Posted on 2007-01-30 16:53  水如烟(LzmTW)  阅读(428)  评论(0编辑  收藏  举报

Author:水如烟

通过以下代码来提取数据库信息:


Public Class Form1

    
Dim DbBuilder As DbBuilder = New Sql9Builder("Data Source=.\SQLExpress;Integrated Security=True")

    
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        GetDatabaseInfo(
"AdventureWorks")
    
End Sub

    
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        GetDatabaseInfo(
"Northwind")
    
End Sub

    
Private Sub GetDatabaseInfo(ByVal database As String)
        DbBuilder.ReadInfoFrom(database)

        
'枚举类
        Dim file As New IO.StreamWriter(DbBuilder.Catalog.Name & ".vb"False, System.Text.Encoding.Default)
        
With file
            .WriteLine(DbBuilder.GetAttrCatalogString)

            
For Each t As TableInfoBase In DbBuilder.Catalog.Tables.Values
                .WriteLine(DbBuilder.GetEnumTableString(t.FullName))
            
Next

            .Flush()
            .Close()
            .Dispose()
        
End With

        
'实体类
        file = New IO.StreamWriter(DbBuilder.Catalog.Name & "Class.vb"False, System.Text.Encoding.Default)
        
With file
            
For Each t As TableInfoBase In DbBuilder.Catalog.Tables.Values
                .WriteLine(DbBuilder.GetClassTableString(t.FullName))
            
Next

            .Flush()
            .Close()
            .Dispose()
        
End With

        Console.WriteLine(
"Finish")
    
End Sub


    
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        
Dim ass As Reflection.Assembly = Reflection.Assembly.LoadFrom("DatabaseBuilderApplication.exe")
        DbBuilder.ReadInfoFrom(ass)

        
'查询器使用的SQL脚本
        Dim file As New IO.StreamWriter(DbBuilder.Catalog.Name & ".sql"False, System.Text.Encoding.Default)
        
With file
            .WriteLine(DbBuilder.GetAllScript)

            .Flush()
            .Close()
            .Dispose()
        
End With
    
End Sub

End Class

提取到的Northwind信息如下:
枚举类,

 

<Assembly: AssemblySql9Catalog(Name:="Northwind",Server:=".\SQLExpress")>

<Sql9Table(Name:="Categories",Schema:="dbo")> _
Public Enum Categories
    
<Sql9int(Name:="CategoryID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    [CategoryID]

    
<Sql9nvarchar(Name:="CategoryName",IsNullable:=False,Length:=15)> _
    [CategoryName]

    
<Sql9ntext(Name:="Description")> _
    [Description]

    
<Sql9image(Name:="Picture")> _
    [Picture]

End Enum



<Sql9Table(Name:="CustomerCustomerDemo",Schema:="dbo")> _
Public Enum CustomerCustomerDemo
    
<Sql9nchar(Name:="CustomerID",IsPrimary:=True,IsNullable:=False,Length:=5)> _
    [CustomerID]

    
<Sql9nchar(Name:="CustomerTypeID",IsPrimary:=True,IsNullable:=False,Length:=10)> _
    [CustomerTypeID]

End Enum



<Sql9Table(Name:="CustomerDemographics",Schema:="dbo")> _
Public Enum CustomerDemographics
    
<Sql9nchar(Name:="CustomerTypeID",IsPrimary:=True,IsNullable:=False,Length:=10)> _
    [CustomerTypeID]

    
<Sql9ntext(Name:="CustomerDesc")> _
    [CustomerDesc]

End Enum



<Sql9Table(Name:="Customers",Schema:="dbo")> _
Public Enum Customers
    
<Sql9nchar(Name:="CustomerID",IsPrimary:=True,IsNullable:=False,Length:=5)> _
    [CustomerID]

    
<Sql9nvarchar(Name:="CompanyName",IsNullable:=False,Length:=40)> _
    [CompanyName]

    
<Sql9nvarchar(Name:="ContactName",Length:=30)> _
    [ContactName]

    
<Sql9nvarchar(Name:="ContactTitle",Length:=30)> _
    [ContactTitle]

    
<Sql9nvarchar(Name:="Address",Length:=60)> _
    [Address]

    
<Sql9nvarchar(Name:="City",Length:=15)> _
    [City]

    
<Sql9nvarchar(Name:="Region",Length:=15)> _
    [Region]

    
<Sql9nvarchar(Name:="PostalCode",Length:=10)> _
    [PostalCode]

    
<Sql9nvarchar(Name:="Country",Length:=15)> _
    [Country]

    
<Sql9nvarchar(Name:="Phone",Length:=24)> _
    [Phone]

    
<Sql9nvarchar(Name:="Fax",Length:=24)> _
    [Fax]

End Enum



<Sql9Table(Name:="Employees",Schema:="dbo")> _
Public Enum Employees
    
<Sql9int(Name:="EmployeeID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    [EmployeeID]

    
<Sql9nvarchar(Name:="LastName",IsNullable:=False,Length:=20)> _
    [LastName]

    
<Sql9nvarchar(Name:="FirstName",IsNullable:=False,Length:=10)> _
    [FirstName]

    
<Sql9nvarchar(Name:="Title",Length:=30)> _
    [Title]

    
<Sql9nvarchar(Name:="TitleOfCourtesy",Length:=25)> _
    [TitleOfCourtesy]

    
<Sql9datetime(Name:="BirthDate")> _
    [BirthDate]

    
<Sql9datetime(Name:="HireDate")> _
    [HireDate]

    
<Sql9nvarchar(Name:="Address",Length:=60)> _
    [Address]

    
<Sql9nvarchar(Name:="City",Length:=15)> _
    [City]

    
<Sql9nvarchar(Name:="Region",Length:=15)> _
    [Region]

    
<Sql9nvarchar(Name:="PostalCode",Length:=10)> _
    [PostalCode]

    
<Sql9nvarchar(Name:="Country",Length:=15)> _
    [Country]

    
<Sql9nvarchar(Name:="HomePhone",Length:=24)> _
    [HomePhone]

    
<Sql9nvarchar(Name:="Extension",Length:=4)> _
    [Extension]

    
<Sql9image(Name:="Photo")> _
    [Photo]

    
<Sql9ntext(Name:="Notes")> _
    [Notes]

    
<Sql9int(Name:="ReportsTo")> _
    [ReportsTo]

    
<Sql9nvarchar(Name:="PhotoPath",Length:=255)> _
    [PhotoPath]

End Enum



<Sql9Table(Name:="EmployeeTerritories",Schema:="dbo")> _
Public Enum EmployeeTerritories
    
<Sql9int(Name:="EmployeeID",IsPrimary:=True,IsNullable:=False)> _
    [EmployeeID]

    
<Sql9nvarchar(Name:="TerritoryID",IsPrimary:=True,IsNullable:=False,Length:=20)> _
    [TerritoryID]

End Enum



<Sql9Table(Name:="Order Details",Schema:="dbo")> _
Public Enum Order_Details
    
<Sql9int(Name:="OrderID",IsPrimary:=True,IsNullable:=False)> _
    [OrderID]

    
<Sql9int(Name:="ProductID",IsPrimary:=True,IsNullable:=False)> _
    [ProductID]

    
<Sql9money(Name:="UnitPrice",IsNullable:=False,DefaultOrBinding:="((0))")> _
    [UnitPrice]

    
<Sql9smallint(Name:="Quantity",IsNullable:=False,DefaultOrBinding:="((1))")> _
    [Quantity]

    
<Sql9real(Name:="Discount",IsNullable:=False,DefaultOrBinding:="((0))")> _
    [Discount]

End Enum



<Sql9Table(Name:="Orders",Schema:="dbo")> _
Public Enum Orders
    
<Sql9int(Name:="OrderID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    [OrderID]

    
<Sql9nchar(Name:="CustomerID",Length:=5)> _
    [CustomerID]

    
<Sql9int(Name:="EmployeeID")> _
    [EmployeeID]

    
<Sql9datetime(Name:="OrderDate")> _
    [OrderDate]

    
<Sql9datetime(Name:="RequiredDate")> _
    [RequiredDate]

    
<Sql9datetime(Name:="ShippedDate")> _
    [ShippedDate]

    
<Sql9int(Name:="ShipVia")> _
    [ShipVia]

    
<Sql9money(Name:="Freight",DefaultOrBinding:="((0))")> _
    [Freight]

    
<Sql9nvarchar(Name:="ShipName",Length:=40)> _
    [ShipName]

    
<Sql9nvarchar(Name:="ShipAddress",Length:=60)> _
    [ShipAddress]

    
<Sql9nvarchar(Name:="ShipCity",Length:=15)> _
    [ShipCity]

    
<Sql9nvarchar(Name:="ShipRegion",Length:=15)> _
    [ShipRegion]

    
<Sql9nvarchar(Name:="ShipPostalCode",Length:=10)> _
    [ShipPostalCode]

    
<Sql9nvarchar(Name:="ShipCountry",Length:=15)> _
    [ShipCountry]

End Enum



<Sql9Table(Name:="Products",Schema:="dbo")> _
Public Enum Products
    
<Sql9int(Name:="ProductID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    [ProductID]

    
<Sql9nvarchar(Name:="ProductName",IsNullable:=False,Length:=40)> _
    [ProductName]

    
<Sql9int(Name:="SupplierID")> _
    [SupplierID]

    
<Sql9int(Name:="CategoryID")> _
    [CategoryID]

    
<Sql9nvarchar(Name:="QuantityPerUnit",Length:=20)> _
    [QuantityPerUnit]

    
<Sql9money(Name:="UnitPrice",DefaultOrBinding:="((0))")> _
    [UnitPrice]

    
<Sql9smallint(Name:="UnitsInStock",DefaultOrBinding:="((0))")> _
    [UnitsInStock]

    
<Sql9smallint(Name:="UnitsOnOrder",DefaultOrBinding:="((0))")> _
    [UnitsOnOrder]

    
<Sql9smallint(Name:="ReorderLevel",DefaultOrBinding:="((0))")> _
    [ReorderLevel]

    
<Sql9bit(Name:="Discontinued",IsNullable:=False,DefaultOrBinding:="((0))")> _
    [Discontinued]

End Enum



<Sql9Table(Name:="Region",Schema:="dbo")> _
Public Enum Region
    
<Sql9int(Name:="RegionID",IsPrimary:=True,IsNullable:=False)> _
    [RegionID]

    
<Sql9nchar(Name:="RegionDescription",IsNullable:=False,Length:=50)> _
    [RegionDescription]

End Enum



<Sql9Table(Name:="Shippers",Schema:="dbo")> _
Public Enum Shippers
    
<Sql9int(Name:="ShipperID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    [ShipperID]

    
<Sql9nvarchar(Name:="CompanyName",IsNullable:=False,Length:=40)> _
    [CompanyName]

    
<Sql9nvarchar(Name:="Phone",Length:=24)> _
    [Phone]

End Enum



<Sql9Table(Name:="Suppliers",Schema:="dbo")> _
Public Enum Suppliers
    
<Sql9int(Name:="SupplierID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    [SupplierID]

    
<Sql9nvarchar(Name:="CompanyName",IsNullable:=False,Length:=40)> _
    [CompanyName]

    
<Sql9nvarchar(Name:="ContactName",Length:=30)> _
    [ContactName]

    
<Sql9nvarchar(Name:="ContactTitle",Length:=30)> _
    [ContactTitle]

    
<Sql9nvarchar(Name:="Address",Length:=60)> _
    [Address]

    
<Sql9nvarchar(Name:="City",Length:=15)> _
    [City]

    
<Sql9nvarchar(Name:="Region",Length:=15)> _
    [Region]

    
<Sql9nvarchar(Name:="PostalCode",Length:=10)> _
    [PostalCode]

    
<Sql9nvarchar(Name:="Country",Length:=15)> _
    [Country]

    
<Sql9nvarchar(Name:="Phone",Length:=24)> _
    [Phone]

    
<Sql9nvarchar(Name:="Fax",Length:=24)> _
    [Fax]

    
<Sql9ntext(Name:="HomePage")> _
    [HomePage]

End Enum



<Sql9Table(Name:="Territories",Schema:="dbo")> _
Public Enum Territories
    
<Sql9nvarchar(Name:="TerritoryID",IsPrimary:=True,IsNullable:=False,Length:=20)> _
    [TerritoryID]

    
<Sql9nchar(Name:="TerritoryDescription",IsNullable:=False,Length:=50)> _
    [TerritoryDescription]

    
<Sql9int(Name:="RegionID",IsNullable:=False)> _
    [RegionID]

End Enum

实体类.

 


<Sql9Table(Name:="Categories",Schema:="dbo")> _
Public Class CategoriesClass
    
Private gCategoryID As Int32
    
Private gCategoryName As String
    
Private gDescription As String
    
Private gPicture As Byte()

    
<Sql9int(Name:="CategoryID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    
Public Property [CategoryID]() As Int32
        
Get
            
Return gCategoryID
        
End Get
        
Set(ByVal value As Int32)
            gCategoryID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="CategoryName",IsNullable:=False,Length:=15)> _
    
Public Property [CategoryName]() As String
        
Get
            
Return gCategoryName
        
End Get
        
Set(ByVal value As String)
            gCategoryName 
= value
        
End Set
    
End Property

    
<Sql9ntext(Name:="Description")> _
    
Public Property [Description]() As String
        
Get
            
Return gDescription
        
End Get
        
Set(ByVal value As String)
            gDescription 
= value
        
End Set
    
End Property

    
<Sql9image(Name:="Picture")> _
    
Public Property [Picture]() As Byte()
        
Get
            
Return gPicture
        
End Get
        
Set(ByVal value As Byte())
            gPicture 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="CustomerCustomerDemo",Schema:="dbo")> _
Public Class CustomerCustomerDemoClass
    
Private gCustomerID As String
    
Private gCustomerTypeID As String

    
<Sql9nchar(Name:="CustomerID",IsPrimary:=True,IsNullable:=False,Length:=5)> _
    
Public Property [CustomerID]() As String
        
Get
            
Return gCustomerID
        
End Get
        
Set(ByVal value As String)
            gCustomerID 
= value
        
End Set
    
End Property

    
<Sql9nchar(Name:="CustomerTypeID",IsPrimary:=True,IsNullable:=False,Length:=10)> _
    
Public Property [CustomerTypeID]() As String
        
Get
            
Return gCustomerTypeID
        
End Get
        
Set(ByVal value As String)
            gCustomerTypeID 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="CustomerDemographics",Schema:="dbo")> _
Public Class CustomerDemographicsClass
    
Private gCustomerTypeID As String
    
Private gCustomerDesc As String

    
<Sql9nchar(Name:="CustomerTypeID",IsPrimary:=True,IsNullable:=False,Length:=10)> _
    
Public Property [CustomerTypeID]() As String
        
Get
            
Return gCustomerTypeID
        
End Get
        
Set(ByVal value As String)
            gCustomerTypeID 
= value
        
End Set
    
End Property

    
<Sql9ntext(Name:="CustomerDesc")> _
    
Public Property [CustomerDesc]() As String
        
Get
            
Return gCustomerDesc
        
End Get
        
Set(ByVal value As String)
            gCustomerDesc 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Customers",Schema:="dbo")> _
Public Class CustomersClass
    
Private gCustomerID As String
    
Private gCompanyName As String
    
Private gContactName As String
    
Private gContactTitle As String
    
Private gAddress As String
    
Private gCity As String
    
Private gRegion As String
    
Private gPostalCode As String
    
Private gCountry As String
    
Private gPhone As String
    
Private gFax As String

    
<Sql9nchar(Name:="CustomerID",IsPrimary:=True,IsNullable:=False,Length:=5)> _
    
Public Property [CustomerID]() As String
        
Get
            
Return gCustomerID
        
End Get
        
Set(ByVal value As String)
            gCustomerID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="CompanyName",IsNullable:=False,Length:=40)> _
    
Public Property [CompanyName]() As String
        
Get
            
Return gCompanyName
        
End Get
        
Set(ByVal value As String)
            gCompanyName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ContactName",Length:=30)> _
    
Public Property [ContactName]() As String
        
Get
            
Return gContactName
        
End Get
        
Set(ByVal value As String)
            gContactName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ContactTitle",Length:=30)> _
    
Public Property [ContactTitle]() As String
        
Get
            
Return gContactTitle
        
End Get
        
Set(ByVal value As String)
            gContactTitle 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Address",Length:=60)> _
    
Public Property [Address]() As String
        
Get
            
Return gAddress
        
End Get
        
Set(ByVal value As String)
            gAddress 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="City",Length:=15)> _
    
Public Property [City]() As String
        
Get
            
Return gCity
        
End Get
        
Set(ByVal value As String)
            gCity 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Region",Length:=15)> _
    
Public Property [Region]() As String
        
Get
            
Return gRegion
        
End Get
        
Set(ByVal value As String)
            gRegion 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="PostalCode",Length:=10)> _
    
Public Property [PostalCode]() As String
        
Get
            
Return gPostalCode
        
End Get
        
Set(ByVal value As String)
            gPostalCode 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Country",Length:=15)> _
    
Public Property [Country]() As String
        
Get
            
Return gCountry
        
End Get
        
Set(ByVal value As String)
            gCountry 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Phone",Length:=24)> _
    
Public Property [Phone]() As String
        
Get
            
Return gPhone
        
End Get
        
Set(ByVal value As String)
            gPhone 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Fax",Length:=24)> _
    
Public Property [Fax]() As String
        
Get
            
Return gFax
        
End Get
        
Set(ByVal value As String)
            gFax 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Employees",Schema:="dbo")> _
Public Class EmployeesClass
    
Private gEmployeeID As Int32
    
Private gLastName As String
    
Private gFirstName As String
    
Private gTitle As String
    
Private gTitleOfCourtesy As String
    
Private gBirthDate As DateTime
    
Private gHireDate As DateTime
    
Private gAddress As String
    
Private gCity As String
    
Private gRegion As String
    
Private gPostalCode As String
    
Private gCountry As String
    
Private gHomePhone As String
    
Private gExtension As String
    
Private gPhoto As Byte()
    
Private gNotes As String
    
Private gReportsTo As Int32
    
Private gPhotoPath As String

    
<Sql9int(Name:="EmployeeID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    
Public Property [EmployeeID]() As Int32
        
Get
            
Return gEmployeeID
        
End Get
        
Set(ByVal value As Int32)
            gEmployeeID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="LastName",IsNullable:=False,Length:=20)> _
    
Public Property [LastName]() As String
        
Get
            
Return gLastName
        
End Get
        
Set(ByVal value As String)
            gLastName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="FirstName",IsNullable:=False,Length:=10)> _
    
Public Property [FirstName]() As String
        
Get
            
Return gFirstName
        
End Get
        
Set(ByVal value As String)
            gFirstName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Title",Length:=30)> _
    
Public Property [Title]() As String
        
Get
            
Return gTitle
        
End Get
        
Set(ByVal value As String)
            gTitle 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="TitleOfCourtesy",Length:=25)> _
    
Public Property [TitleOfCourtesy]() As String
        
Get
            
Return gTitleOfCourtesy
        
End Get
        
Set(ByVal value As String)
            gTitleOfCourtesy 
= value
        
End Set
    
End Property

    
<Sql9datetime(Name:="BirthDate")> _
    
Public Property [BirthDate]() As DateTime
        
Get
            
Return gBirthDate
        
End Get
        
Set(ByVal value As DateTime)
            gBirthDate 
= value
        
End Set
    
End Property

    
<Sql9datetime(Name:="HireDate")> _
    
Public Property [HireDate]() As DateTime
        
Get
            
Return gHireDate
        
End Get
        
Set(ByVal value As DateTime)
            gHireDate 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Address",Length:=60)> _
    
Public Property [Address]() As String
        
Get
            
Return gAddress
        
End Get
        
Set(ByVal value As String)
            gAddress 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="City",Length:=15)> _
    
Public Property [City]() As String
        
Get
            
Return gCity
        
End Get
        
Set(ByVal value As String)
            gCity 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Region",Length:=15)> _
    
Public Property [Region]() As String
        
Get
            
Return gRegion
        
End Get
        
Set(ByVal value As String)
            gRegion 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="PostalCode",Length:=10)> _
    
Public Property [PostalCode]() As String
        
Get
            
Return gPostalCode
        
End Get
        
Set(ByVal value As String)
            gPostalCode 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Country",Length:=15)> _
    
Public Property [Country]() As String
        
Get
            
Return gCountry
        
End Get
        
Set(ByVal value As String)
            gCountry 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="HomePhone",Length:=24)> _
    
Public Property [HomePhone]() As String
        
Get
            
Return gHomePhone
        
End Get
        
Set(ByVal value As String)
            gHomePhone 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Extension",Length:=4)> _
    
Public Property [Extension]() As String
        
Get
            
Return gExtension
        
End Get
        
Set(ByVal value As String)
            gExtension 
= value
        
End Set
    
End Property

    
<Sql9image(Name:="Photo")> _
    
Public Property [Photo]() As Byte()
        
Get
            
Return gPhoto
        
End Get
        
Set(ByVal value As Byte())
            gPhoto 
= value
        
End Set
    
End Property

    
<Sql9ntext(Name:="Notes")> _
    
Public Property [Notes]() As String
        
Get
            
Return gNotes
        
End Get
        
Set(ByVal value As String)
            gNotes 
= value
        
End Set
    
End Property

    
<Sql9int(Name:="ReportsTo")> _
    
Public Property [ReportsTo]() As Int32
        
Get
            
Return gReportsTo
        
End Get
        
Set(ByVal value As Int32)
            gReportsTo 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="PhotoPath",Length:=255)> _
    
Public Property [PhotoPath]() As String
        
Get
            
Return gPhotoPath
        
End Get
        
Set(ByVal value As String)
            gPhotoPath 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="EmployeeTerritories",Schema:="dbo")> _
Public Class EmployeeTerritoriesClass
    
Private gEmployeeID As Int32
    
Private gTerritoryID As String

    
<Sql9int(Name:="EmployeeID",IsPrimary:=True,IsNullable:=False)> _
    
Public Property [EmployeeID]() As Int32
        
Get
            
Return gEmployeeID
        
End Get
        
Set(ByVal value As Int32)
            gEmployeeID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="TerritoryID",IsPrimary:=True,IsNullable:=False,Length:=20)> _
    
Public Property [TerritoryID]() As String
        
Get
            
Return gTerritoryID
        
End Get
        
Set(ByVal value As String)
            gTerritoryID 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Order Details",Schema:="dbo")> _
Public Class Order_DetailsClass
    
Private gOrderID As Int32
    
Private gProductID As Int32
    
Private gUnitPrice As Decimal
    
Private gQuantity As Int16
    
Private gDiscount As Single

    
<Sql9int(Name:="OrderID",IsPrimary:=True,IsNullable:=False)> _
    
Public Property [OrderID]() As Int32
        
Get
            
Return gOrderID
        
End Get
        
Set(ByVal value As Int32)
            gOrderID 
= value
        
End Set
    
End Property

    
<Sql9int(Name:="ProductID",IsPrimary:=True,IsNullable:=False)> _
    
Public Property [ProductID]() As Int32
        
Get
            
Return gProductID
        
End Get
        
Set(ByVal value As Int32)
            gProductID 
= value
        
End Set
    
End Property

    
<Sql9money(Name:="UnitPrice",IsNullable:=False,DefaultOrBinding:="((0))")> _
    
Public Property [UnitPrice]() As Decimal
        
Get
            
Return gUnitPrice
        
End Get
        
Set(ByVal value As Decimal)
            gUnitPrice 
= value
        
End Set
    
End Property

    
<Sql9smallint(Name:="Quantity",IsNullable:=False,DefaultOrBinding:="((1))")> _
    
Public Property [Quantity]() As Int16
        
Get
            
Return gQuantity
        
End Get
        
Set(ByVal value As Int16)
            gQuantity 
= value
        
End Set
    
End Property

    
<Sql9real(Name:="Discount",IsNullable:=False,DefaultOrBinding:="((0))")> _
    
Public Property [Discount]() As Single
        
Get
            
Return gDiscount
        
End Get
        
Set(ByVal value As Single)
            gDiscount 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Orders",Schema:="dbo")> _
Public Class OrdersClass
    
Private gOrderID As Int32
    
Private gCustomerID As String
    
Private gEmployeeID As Int32
    
Private gOrderDate As DateTime
    
Private gRequiredDate As DateTime
    
Private gShippedDate As DateTime
    
Private gShipVia As Int32
    
Private gFreight As Decimal
    
Private gShipName As String
    
Private gShipAddress As String
    
Private gShipCity As String
    
Private gShipRegion As String
    
Private gShipPostalCode As String
    
Private gShipCountry As String

    
<Sql9int(Name:="OrderID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    
Public Property [OrderID]() As Int32
        
Get
            
Return gOrderID
        
End Get
        
Set(ByVal value As Int32)
            gOrderID 
= value
        
End Set
    
End Property

    
<Sql9nchar(Name:="CustomerID",Length:=5)> _
    
Public Property [CustomerID]() As String
        
Get
            
Return gCustomerID
        
End Get
        
Set(ByVal value As String)
            gCustomerID 
= value
        
End Set
    
End Property

    
<Sql9int(Name:="EmployeeID")> _
    
Public Property [EmployeeID]() As Int32
        
Get
            
Return gEmployeeID
        
End Get
        
Set(ByVal value As Int32)
            gEmployeeID 
= value
        
End Set
    
End Property

    
<Sql9datetime(Name:="OrderDate")> _
    
Public Property [OrderDate]() As DateTime
        
Get
            
Return gOrderDate
        
End Get
        
Set(ByVal value As DateTime)
            gOrderDate 
= value
        
End Set
    
End Property

    
<Sql9datetime(Name:="RequiredDate")> _
    
Public Property [RequiredDate]() As DateTime
        
Get
            
Return gRequiredDate
        
End Get
        
Set(ByVal value As DateTime)
            gRequiredDate 
= value
        
End Set
    
End Property

    
<Sql9datetime(Name:="ShippedDate")> _
    
Public Property [ShippedDate]() As DateTime
        
Get
            
Return gShippedDate
        
End Get
        
Set(ByVal value As DateTime)
            gShippedDate 
= value
        
End Set
    
End Property

    
<Sql9int(Name:="ShipVia")> _
    
Public Property [ShipVia]() As Int32
        
Get
            
Return gShipVia
        
End Get
        
Set(ByVal value As Int32)
            gShipVia 
= value
        
End Set
    
End Property

    
<Sql9money(Name:="Freight",DefaultOrBinding:="((0))")> _
    
Public Property [Freight]() As Decimal
        
Get
            
Return gFreight
        
End Get
        
Set(ByVal value As Decimal)
            gFreight 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ShipName",Length:=40)> _
    
Public Property [ShipName]() As String
        
Get
            
Return gShipName
        
End Get
        
Set(ByVal value As String)
            gShipName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ShipAddress",Length:=60)> _
    
Public Property [ShipAddress]() As String
        
Get
            
Return gShipAddress
        
End Get
        
Set(ByVal value As String)
            gShipAddress 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ShipCity",Length:=15)> _
    
Public Property [ShipCity]() As String
        
Get
            
Return gShipCity
        
End Get
        
Set(ByVal value As String)
            gShipCity 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ShipRegion",Length:=15)> _
    
Public Property [ShipRegion]() As String
        
Get
            
Return gShipRegion
        
End Get
        
Set(ByVal value As String)
            gShipRegion 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ShipPostalCode",Length:=10)> _
    
Public Property [ShipPostalCode]() As String
        
Get
            
Return gShipPostalCode
        
End Get
        
Set(ByVal value As String)
            gShipPostalCode 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ShipCountry",Length:=15)> _
    
Public Property [ShipCountry]() As String
        
Get
            
Return gShipCountry
        
End Get
        
Set(ByVal value As String)
            gShipCountry 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Products",Schema:="dbo")> _
Public Class ProductsClass
    
Private gProductID As Int32
    
Private gProductName As String
    
Private gSupplierID As Int32
    
Private gCategoryID As Int32
    
Private gQuantityPerUnit As String
    
Private gUnitPrice As Decimal
    
Private gUnitsInStock As Int16
    
Private gUnitsOnOrder As Int16
    
Private gReorderLevel As Int16
    
Private gDiscontinued As Boolean

    
<Sql9int(Name:="ProductID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    
Public Property [ProductID]() As Int32
        
Get
            
Return gProductID
        
End Get
        
Set(ByVal value As Int32)
            gProductID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ProductName",IsNullable:=False,Length:=40)> _
    
Public Property [ProductName]() As String
        
Get
            
Return gProductName
        
End Get
        
Set(ByVal value As String)
            gProductName 
= value
        
End Set
    
End Property

    
<Sql9int(Name:="SupplierID")> _
    
Public Property [SupplierID]() As Int32
        
Get
            
Return gSupplierID
        
End Get
        
Set(ByVal value As Int32)
            gSupplierID 
= value
        
End Set
    
End Property

    
<Sql9int(Name:="CategoryID")> _
    
Public Property [CategoryID]() As Int32
        
Get
            
Return gCategoryID
        
End Get
        
Set(ByVal value As Int32)
            gCategoryID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="QuantityPerUnit",Length:=20)> _
    
Public Property [QuantityPerUnit]() As String
        
Get
            
Return gQuantityPerUnit
        
End Get
        
Set(ByVal value As String)
            gQuantityPerUnit 
= value
        
End Set
    
End Property

    
<Sql9money(Name:="UnitPrice",DefaultOrBinding:="((0))")> _
    
Public Property [UnitPrice]() As Decimal
        
Get
            
Return gUnitPrice
        
End Get
        
Set(ByVal value As Decimal)
            gUnitPrice 
= value
        
End Set
    
End Property

    
<Sql9smallint(Name:="UnitsInStock",DefaultOrBinding:="((0))")> _
    
Public Property [UnitsInStock]() As Int16
        
Get
            
Return gUnitsInStock
        
End Get
        
Set(ByVal value As Int16)
            gUnitsInStock 
= value
        
End Set
    
End Property

    
<Sql9smallint(Name:="UnitsOnOrder",DefaultOrBinding:="((0))")> _
    
Public Property [UnitsOnOrder]() As Int16
        
Get
            
Return gUnitsOnOrder
        
End Get
        
Set(ByVal value As Int16)
            gUnitsOnOrder 
= value
        
End Set
    
End Property

    
<Sql9smallint(Name:="ReorderLevel",DefaultOrBinding:="((0))")> _
    
Public Property [ReorderLevel]() As Int16
        
Get
            
Return gReorderLevel
        
End Get
        
Set(ByVal value As Int16)
            gReorderLevel 
= value
        
End Set
    
End Property

    
<Sql9bit(Name:="Discontinued",IsNullable:=False,DefaultOrBinding:="((0))")> _
    
Public Property [Discontinued]() As Boolean
        
Get
            
Return gDiscontinued
        
End Get
        
Set(ByVal value As Boolean)
            gDiscontinued 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Region",Schema:="dbo")> _
Public Class RegionClass
    
Private gRegionID As Int32
    
Private gRegionDescription As String

    
<Sql9int(Name:="RegionID",IsPrimary:=True,IsNullable:=False)> _
    
Public Property [RegionID]() As Int32
        
Get
            
Return gRegionID
        
End Get
        
Set(ByVal value As Int32)
            gRegionID 
= value
        
End Set
    
End Property

    
<Sql9nchar(Name:="RegionDescription",IsNullable:=False,Length:=50)> _
    
Public Property [RegionDescription]() As String
        
Get
            
Return gRegionDescription
        
End Get
        
Set(ByVal value As String)
            gRegionDescription 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Shippers",Schema:="dbo")> _
Public Class ShippersClass
    
Private gShipperID As Int32
    
Private gCompanyName As String
    
Private gPhone As String

    
<Sql9int(Name:="ShipperID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    
Public Property [ShipperID]() As Int32
        
Get
            
Return gShipperID
        
End Get
        
Set(ByVal value As Int32)
            gShipperID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="CompanyName",IsNullable:=False,Length:=40)> _
    
Public Property [CompanyName]() As String
        
Get
            
Return gCompanyName
        
End Get
        
Set(ByVal value As String)
            gCompanyName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Phone",Length:=24)> _
    
Public Property [Phone]() As String
        
Get
            
Return gPhone
        
End Get
        
Set(ByVal value As String)
            gPhone 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Suppliers",Schema:="dbo")> _
Public Class SuppliersClass
    
Private gSupplierID As Int32
    
Private gCompanyName As String
    
Private gContactName As String
    
Private gContactTitle As String
    
Private gAddress As String
    
Private gCity As String
    
Private gRegion As String
    
Private gPostalCode As String
    
Private gCountry As String
    
Private gPhone As String
    
Private gFax As String
    
Private gHomePage As String

    
<Sql9int(Name:="SupplierID",IsPrimary:=True,IsNullable:=False,IsIdentity:=True)> _
    
Public Property [SupplierID]() As Int32
        
Get
            
Return gSupplierID
        
End Get
        
Set(ByVal value As Int32)
            gSupplierID 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="CompanyName",IsNullable:=False,Length:=40)> _
    
Public Property [CompanyName]() As String
        
Get
            
Return gCompanyName
        
End Get
        
Set(ByVal value As String)
            gCompanyName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ContactName",Length:=30)> _
    
Public Property [ContactName]() As String
        
Get
            
Return gContactName
        
End Get
        
Set(ByVal value As String)
            gContactName 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="ContactTitle",Length:=30)> _
    
Public Property [ContactTitle]() As String
        
Get
            
Return gContactTitle
        
End Get
        
Set(ByVal value As String)
            gContactTitle 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Address",Length:=60)> _
    
Public Property [Address]() As String
        
Get
            
Return gAddress
        
End Get
        
Set(ByVal value As String)
            gAddress 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="City",Length:=15)> _
    
Public Property [City]() As String
        
Get
            
Return gCity
        
End Get
        
Set(ByVal value As String)
            gCity 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Region",Length:=15)> _
    
Public Property [Region]() As String
        
Get
            
Return gRegion
        
End Get
        
Set(ByVal value As String)
            gRegion 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="PostalCode",Length:=10)> _
    
Public Property [PostalCode]() As String
        
Get
            
Return gPostalCode
        
End Get
        
Set(ByVal value As String)
            gPostalCode 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Country",Length:=15)> _
    
Public Property [Country]() As String
        
Get
            
Return gCountry
        
End Get
        
Set(ByVal value As String)
            gCountry 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Phone",Length:=24)> _
    
Public Property [Phone]() As String
        
Get
            
Return gPhone
        
End Get
        
Set(ByVal value As String)
            gPhone 
= value
        
End Set
    
End Property

    
<Sql9nvarchar(Name:="Fax",Length:=24)> _
    
Public Property [Fax]() As String
        
Get
            
Return gFax
        
End Get
        
Set(ByVal value As String)
            gFax 
= value
        
End Set
    
End Property

    
<Sql9ntext(Name:="HomePage")> _
    
Public Property [HomePage]() As String
        
Get
            
Return gHomePage
        
End Get
        
Set(ByVal value As String)
            gHomePage 
= value
        
End Set
    
End Property

End Class



<Sql9Table(Name:="Territories",Schema:="dbo")> _
Public Class TerritoriesClass
    
Private gTerritoryID As String
    
Private gTerritoryDescription As String
    
Private gRegionID As Int32

    
<Sql9nvarchar(Name:="TerritoryID",IsPrimary:=True,IsNullable:=False,Length:=20)> _
    
Public Property [TerritoryID]() As String
        
Get
            
Return gTerritoryID
        
End Get
        
Set(ByVal value As String)
            gTerritoryID 
= value
        
End Set
    
End Property

    
<Sql9nchar(Name:="TerritoryDescription",IsNullable:=False,Length:=50)> _
    
Public Property [TerritoryDescription]() As String
        
Get
            
Return gTerritoryDescription
        
End Get
        
Set(ByVal value As String)
            gTerritoryDescription 
= value
        
End Set
    
End Property

    
<Sql9int(Name:="RegionID",IsNullable:=False)> _
    
Public Property [RegionID]() As Int32
        
Get
            
Return gRegionID
        
End Get
        
Set(ByVal value As Int32)
            gRegionID 
= value
        
End Set
    
End Property

End Class

这样的结果,我觉得表现简单,信息丰富,方便利用.