本文整理匯總了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
示例2: GetType
' Get the metatable for the table with the
' specified table name and the specified data
' context.
mTable = model.GetTable("CustomerAddresses", GetType(AdventureWorksLTDataContext))
示例3:
' Get the metatable for the table with the
' specified entity type.
mTable = model.GetTable(GetType(CustomerAddress))
示例4:
' Get the metatable for the table with the
' specified table name.
mTable = model.GetTable("CustomerAddresses")