แก้ไข

แชร์ผ่าน


MetaModel Constructors

Definition

Instantiates a new instance of the MetaModel class.

Overloads

MetaModel()

Instantiates a new instance of the MetaModel class.

MetaModel(Boolean)

Instantiates a new instance of the MetaModel class.

MetaModel()

Instantiates a new instance of the MetaModel class.

public:
 MetaModel();
public MetaModel ();
Public Sub New ()

Examples

The following example shows how to use the MetaModel constructor to perform the following tasks:

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

Remarks

You typically call the MetaModel constructor in the Application_Start method of the Global.asax file.

Applies to

MetaModel(Boolean)

Instantiates a new instance of the MetaModel class.

public:
 MetaModel(bool registerGlobally);
public MetaModel (bool registerGlobally);
new System.Web.DynamicData.MetaModel : bool -> System.Web.DynamicData.MetaModel
Public Sub New (registerGlobally As Boolean)

Parameters

registerGlobally
Boolean

true to indicate that the model is registered globally; otherwise false. The default is true.

Remarks

This constructor determines whether the data model is registered globally so that it can be retrieved using the GetModel method. It enables you to create multiple models and use the same entity types while avoiding type conflicts.

You typically call the MetaModel constructor in the Application_Start method of the Global.asax file.

Applies to