共用方式為


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.

public ModelBuilder ();
Public Sub New ()

Remarks

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

Applies to

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.

public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet conventions);
new Microsoft.EntityFrameworkCore.ModelBuilder : Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Sub New (conventions As ConventionSet)

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

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.

[Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal]
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.IMutableModel model);
[Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal]
[System.Obsolete]
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.IMutableModel model);
[<Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal>]
new Microsoft.EntityFrameworkCore.ModelBuilder : Microsoft.EntityFrameworkCore.Metadata.IMutableModel -> Microsoft.EntityFrameworkCore.ModelBuilder
[<Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal>]
[<System.Obsolete>]
new Microsoft.EntityFrameworkCore.ModelBuilder : Microsoft.EntityFrameworkCore.Metadata.IMutableModel -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Sub New (model As IMutableModel)

Parameters

Attributes

Applies to

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.

public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet conventions, Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies modelDependencies);
new Microsoft.EntityFrameworkCore.ModelBuilder : Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Sub New (conventions As ConventionSet, modelDependencies As 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

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.

[Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal]
public ModelBuilder (Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet conventions, Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies? modelDependencies, Microsoft.EntityFrameworkCore.Metadata.Internal.ModelConfiguration? modelConfiguration);
[<Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternal>]
new Microsoft.EntityFrameworkCore.ModelBuilder : Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies * Microsoft.EntityFrameworkCore.Metadata.Internal.ModelConfiguration -> Microsoft.EntityFrameworkCore.ModelBuilder
Public Sub New (conventions As ConventionSet, modelDependencies As ModelDependencies, modelConfiguration As ModelConfiguration)

Parameters

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

Applies to