Share via


ModelBuilder 构造函数

定义

重载

ModelBuilder()

初始化没有约定的 ModelBuilder 类的新实例。

警告:生成正确的模型需要约定。

ModelBuilder(ConventionSet)

初始化将应用一组约定的 类的新实例 ModelBuilder

ModelBuilder(IMutableModel)
已过时.

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,恕不另行通知。 应仅在代码中直接使用它,并且非常谨慎,并且知道在更新到新的 Entity Framework Core 版本时,这样做可能会导致应用程序失败。

ModelBuilder(ConventionSet, ModelDependencies)

初始化将应用一组约定的 类的新实例 ModelBuilder

ModelBuilder(ConventionSet, ModelDependencies, ModelConfiguration)

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,恕不另行通知。 应仅在代码中直接使用它,并且非常谨慎,并且知道在更新到新的 Entity Framework Core 版本时,这样做可能会导致应用程序失败。

ModelBuilder()

初始化没有约定的 ModelBuilder 类的新实例。

警告:生成正确的模型需要约定。

public ModelBuilder ();
Public Sub New ()

注解

有关详细信息和示例,请参阅 为实体类型和关系建模 以及 EF Core 模型生成约定

适用于

ModelBuilder(ConventionSet)

初始化将应用一组约定的 类的新实例 ModelBuilder

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)

参数

conventions
ConventionSet

要应用于模型的约定。

注解

有关详细信息和示例,请参阅 为实体类型和关系建模 以及 EF Core 模型生成约定

适用于

ModelBuilder(IMutableModel)

注意

现已弃用此 API。

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,恕不另行通知。 应仅在代码中直接使用它,并且非常谨慎,并且知道在更新到新的 Entity Framework Core 版本时,这样做可能会导致应用程序失败。

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

参数

属性

适用于

ModelBuilder(ConventionSet, ModelDependencies)

初始化将应用一组约定的 类的新实例 ModelBuilder

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)

参数

conventions
ConventionSet

要应用于模型的约定。

modelDependencies
ModelDependencies

模型的 dependencies 对象。

注解

有关详细信息和示例,请参阅 为实体类型和关系建模 以及 EF Core 模型生成约定

适用于

ModelBuilder(ConventionSet, ModelDependencies, ModelConfiguration)

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,恕不另行通知。 应仅在代码中直接使用它,并且非常谨慎,并且知道在更新到新的 Entity Framework Core 版本时,这样做可能会导致应用程序失败。

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

参数

conventions
ConventionSet
modelDependencies
ModelDependencies
modelConfiguration
Microsoft.EntityFrameworkCore.Metadata.Internal.ModelConfiguration
属性

适用于