Прочетете на английски

Споделяне чрез


ModelBuilder Constructors

Definition

Overloads

ModelBuilder()

Initializes a new instance of the ModelBuilder class with no conventions.

Warning: conventions are needed to build a correct model.

ModelBuilder(ConventionSet)

Initializes a new instance of the ModelBuilder class that will apply a set of conventions.

ModelBuilder(IMutableModel)
Obsolete.

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

ModelBuilder(ConventionSet, ModelDependencies)

Initializes a new instance of the ModelBuilder class that will apply a set of conventions.

ModelBuilder(ConventionSet, ModelDependencies, ModelConfiguration)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

ModelBuilder()

Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs

Initializes a new instance of the ModelBuilder class with no conventions.

Warning: conventions are needed to build a correct model.

C#
public ModelBuilder ();

Remarks

See Modeling entity types and relationships and EF Core model-building conventions for more information and examples.

Applies to

Entity Framework Core 9.0 и други версии
Продукт Версии
Entity Framework Core 5.0, 6.0, 7.0, 8.0, 9.0

ModelBuilder(ConventionSet)

Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs

Initializes a new instance of the ModelBuilder class that will apply a set of conventions.

C#
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet conventions);

Parameters

conventions
ConventionSet

The conventions to be applied to the model.

Remarks

See Modeling entity types and relationships and EF Core model-building conventions for more information and examples.

Applies to

Entity Framework Core 9.0 и други версии
Продукт Версии
Entity Framework Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

ModelBuilder(IMutableModel)

Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs

Caution

This API is now deprecated.

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

C#
[Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal]
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.IMutableModel model);
C#
[Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal]
[System.Obsolete]
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.IMutableModel model);

Parameters

Attributes

Applies to

Entity Framework Core 9.0 и други версии
Продукт Версии (остаряло)
Entity Framework Core 3.0, 3.1, 7.0, 8.0, 9.0 (5.0, 6.0)

ModelBuilder(ConventionSet, ModelDependencies)

Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs

Initializes a new instance of the ModelBuilder class that will apply a set of conventions.

C#
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet conventions, Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies modelDependencies);

Parameters

conventions
ConventionSet

The conventions to be applied to the model.

modelDependencies
ModelDependencies

The dependencies object for the model.

Remarks

See Modeling entity types and relationships and EF Core model-building conventions for more information and examples.

Applies to

Entity Framework Core 9.0 и други версии
Продукт Версии
Entity Framework Core 5.0, 6.0, 7.0, 8.0, 9.0

ModelBuilder(ConventionSet, ModelDependencies, ModelConfiguration)

Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs
Source:
ModelBuilder.cs

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

C#
[Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal]
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet conventions, Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies? modelDependencies, Microsoft.EntityFrameworkCore.Metadata.Internal.ModelConfiguration? modelConfiguration);

Parameters

conventions
ConventionSet
modelDependencies
ModelDependencies
modelConfiguration
Microsoft.EntityFrameworkCore.Metadata.Internal.ModelConfiguration
Attributes

Applies to

Entity Framework Core 9.0 и други версии
Продукт Версии
Entity Framework Core 6.0, 7.0, 8.0, 9.0