當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET MetaModel.GetTable方法代碼示例

本文整理匯總了VB.NET中System.Web.DynamicData.MetaModel.GetTable方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET MetaModel.GetTable方法的具體用法?VB.NET MetaModel.GetTable怎麽用?VB.NET MetaModel.GetTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Web.DynamicData.MetaModel的用法示例。


在下文中一共展示了MetaModel.GetTable方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: GetAdresses

' 導入命名空間
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Web.DynamicData
Imports System.Text

Partial Public Class DocGetTable
    Inherits System.Web.UI.Page
     Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

     End Sub

    ' Use GetTable methods.
    Public Function GetAdresses(ByVal index As Integer) As String
        ' Get the default data model.
        Dim model As MetaModel = MetaModel.Default

        Dim mTable As MetaTable

        Select Case index
            Case 0
                ' Get the metatable for the table with the
                ' specified entity type.
                mTable = model.GetTable(GetType(CustomerAddress))
            Case 1
                ' Get the metatable for the table with the 
                ' specified table name.
                mTable = model.GetTable("CustomerAddresses")
            Case 2
                ' Get the metatable for the table with the 
                ' specified table name and the specified data
                ' context.
                mTable = model.GetTable("CustomerAddresses", GetType(AdventureWorksLTDataContext))
            Case Else
                mTable = model.GetTable(GetType(CustomerAddress))
        End Select

        ' The following code dislays the actual value 
        ' (adress) associated with a customer and link
        ' to the related Addresses table.
        Dim fkColumn As MetaForeignKeyColumn = CType(mTable.GetColumn("Address"), MetaForeignKeyColumn)

        Dim row As Customer = CType(GetDataItem(), Customer)


        Dim addressList As New StringBuilder()

        For Each childRow As CustomerAddress In row.CustomerAddresses
            addressList.Append(childRow.AddressType)
            addressList.Append(":<br/>")
            addressList.Append("<a href='")
            addressList.Append(fkColumn.GetForeignKeyDetailsPath(childRow.Address))
            addressList.Append("'>")
            addressList.Append(childRow.Address.AddressLine1)
            addressList.Append("</a><br/><br/>")
        Next childRow

        Return addressList.ToString()

    End Function

End Class
開發者ID:VB.NET開發者,項目名稱:System.Web.DynamicData,代碼行數:71,代碼來源:MetaModel.GetTable

示例2: GetType

' Get the metatable for the table with the 
' specified table name and the specified data
' context.
mTable = model.GetTable("CustomerAddresses", GetType(AdventureWorksLTDataContext))
開發者ID:VB.NET開發者,項目名稱:System.Web.DynamicData,代碼行數:4,代碼來源:MetaModel.GetTable

示例3:

' Get the metatable for the table with the
' specified entity type.
mTable = model.GetTable(GetType(CustomerAddress))
開發者ID:VB.NET開發者,項目名稱:System.Web.DynamicData,代碼行數:3,代碼來源:MetaModel.GetTable

示例4:

' Get the metatable for the table with the 
' specified table name.
mTable = model.GetTable("CustomerAddresses")
開發者ID:VB.NET開發者,項目名稱:System.Web.DynamicData,代碼行數:3,代碼來源:MetaModel.GetTable


注:本文中的System.Web.DynamicData.MetaModel.GetTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。