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 ();

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

Remarks

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

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

MetaModel(Boolean)

Instantiates a new instance of the MetaModel class.

public MetaModel (bool registerGlobally);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1