Ler em inglês Editar

Compartilhar via


MetaModel.Default Property

Definition

Gets the first instance of a data model that is created by the application.

public static System.Web.DynamicData.MetaModel Default { get; }

Property Value

The data-model instance.

Examples

The following example shows how to use the Default property in the GetModel method to get the default data model.

For a complete example, see the MetaModel class overview.

// Get the data model. 
public MetaModel GetModel(bool defaultModel)
{
    MetaModel model;

    if (defaultModel)
        model = MetaModel.Default;
    else
        model =
           MetaModel.GetModel(typeof(AdventureWorksLTDataContext));
    return model;
}

Remarks

This property provides a simple way to reference the default data-model instance. If the application uses multiple models, you must provide your own way to store references to the additional data models. To find a specific data model, call the MetaModel.GetModel method.

Applies to

Produto Versões
.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