MetaModel.VisibleTables 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取数据模型中可见表的集合。
public:
property System::Collections::Generic::List<System::Web::DynamicData::MetaTable ^> ^ VisibleTables { System::Collections::Generic::List<System::Web::DynamicData::MetaTable ^> ^ get(); };
public System.Collections.Generic.List<System.Web.DynamicData.MetaTable> VisibleTables { get; }
member this.VisibleTables : System.Collections.Generic.List<System.Web.DynamicData.MetaTable>
Public ReadOnly Property VisibleTables As List(Of MetaTable)
属性值
可见表是指启用了基架的表。 这意味着它是具有 List.aspx 页的表。
示例
以下示例演示如何使用 VisibleTables 属性获取数据模型中可见表的集合。 有关完整示例,请参阅 MetaModel 类概述。
// Gets only the visible tables in the data model.
protected void GetVisibleTables()
{
System.Collections.IList visibleTables =
MetaModel.Default.VisibleTables;
if (visibleTables.Count == 0)
{
throw new InvalidOperationException(
"There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.");
}
Menu1.DataSource = visibleTables;
Menu1.DataBind();
}
' Gets only the visible tables in the data model.
Protected Sub GetVisibleTables()
Dim visibleTables As System.Collections.IList = MetaModel.[Default].VisibleTables
If visibleTables.Count = 0 Then
Throw New InvalidOperationException("There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.")
End If
Menu1.DataSource = visibleTables
Menu1.DataBind()
End Sub