MetaModel 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
實例化該類別的新實例 MetaModel 。
多載
| 名稱 | Description |
|---|---|
| MetaModel() |
實例化該類別的新實例 MetaModel 。 |
| MetaModel(Boolean) |
實例化該類別的新實例 MetaModel 。 |
MetaModel()
實例化該類別的新實例 MetaModel 。
public:
MetaModel();
public MetaModel();
Public Sub New ()
範例
以下範例說明如何使用 MetaModel 建構子執行以下任務:
MetaModel model = new MetaModel();
model.RegisterContext(typeof(AdventureWorksLTDataContext),
new ContextConfiguration() { ScaffoldAllTables = true });
Dim model As New MetaModel
model.RegisterContext(GetType(AdventureWorksLTDataContext), _
New ContextConfiguration() With {.ScaffoldAllTables = True})
備註
你通常會用 Global.asax 檔案的方法呼叫建 MetaModel 構子 Application_Start 。
適用於
MetaModel(Boolean)
實例化該類別的新實例 MetaModel 。
public:
MetaModel(bool registerGlobally);
public MetaModel(bool registerGlobally);
new System.Web.DynamicData.MetaModel : bool -> System.Web.DynamicData.MetaModel
Public Sub New (registerGlobally As Boolean)
參數
- registerGlobally
- Boolean
true 以表示該模型已全球註冊;否則 false。 預設值為 true。
備註
此建構子判斷資料模型是否全域註冊,以便可透過該 GetModel 方法檢索。 它讓你能建立多個模型並使用相同的實體類型,同時避免類型衝突。
你通常會用 Global.asax 檔案的方法呼叫建 MetaModel 構子 Application_Start 。