MetaModel.VisibleTables 属性

定义

获取数据模型中可见表的集合。

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<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

适用于