本文整理汇总了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;未经允许,请勿转载。 |
请发表评论