ModelSource.CreateModel 方法

定义

重载

CreateModel(DbContext, IConventionSetBuilder)
已过时.
已过时.

创建模型。 在缓存中找不到模型时,将调用此方法。

CreateModel(DbContext, IConventionSetBuilder, ModelDependencies)

创建模型。 在缓存中找不到模型时,将调用此方法。

CreateModel(DbContext, IConventionSetBuilder, IModelValidator)

创建模型。 在缓存中找不到模型时,将调用此方法。

CreateModel(DbContext, IConventionSetBuilder, IModelValidator)

创建模型。 在缓存中找不到模型时,将调用此方法。

CreateModel(DbContext, IConventionSetBuilder)

Source:
ModelSource.cs
Source:
ModelSource.cs
Source:
ModelSource.cs
Source:
ModelSource.cs

注意

Use the overload with ModelDependencies

注意

Use the overload with ModelCreationDependencies

创建模型。 在缓存中找不到模型时,将调用此方法。

protected virtual Microsoft.EntityFrameworkCore.Metadata.IModel CreateModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder);
[System.Obsolete("Use the overload with ModelDependencies")]
protected virtual Microsoft.EntityFrameworkCore.Metadata.IModel CreateModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder);
[System.Obsolete("Use the overload with ModelCreationDependencies")]
protected virtual Microsoft.EntityFrameworkCore.Metadata.IModel CreateModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder);
abstract member CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
[<System.Obsolete("Use the overload with ModelDependencies")>]
abstract member CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
[<System.Obsolete("Use the overload with ModelCreationDependencies")>]
abstract member CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
Protected Overridable Function CreateModel (context As DbContext, conventionSetBuilder As IConventionSetBuilder) As IModel

参数

context
DbContext

为其生成模型的上下文。

conventionSetBuilder
IConventionSetBuilder

创建模型时要使用的约定集。

返回

要使用的模型。

属性

适用于

CreateModel(DbContext, IConventionSetBuilder, ModelDependencies)

Source:
ModelSource.cs
Source:
ModelSource.cs
Source:
ModelSource.cs
Source:
ModelSource.cs
Source:
ModelSource.cs

创建模型。 在缓存中找不到模型时,将调用此方法。

protected virtual Microsoft.EntityFrameworkCore.Metadata.IModel CreateModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder, Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies modelDependencies);
abstract member CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies -> Microsoft.EntityFrameworkCore.Metadata.IModel
Protected Overridable Function CreateModel (context As DbContext, conventionSetBuilder As IConventionSetBuilder, modelDependencies As ModelDependencies) As IModel

参数

context
DbContext

为其生成模型的上下文。

conventionSetBuilder
IConventionSetBuilder

创建模型时要使用的约定集。

modelDependencies
ModelDependencies

模型的 dependencies 对象。

返回

要使用的模型。

适用于

CreateModel(DbContext, IConventionSetBuilder, IModelValidator)

Source:
ModelSource.cs
Source:
ModelSource.cs

创建模型。 在缓存中找不到模型时,将调用此方法。

protected virtual Microsoft.EntityFrameworkCore.Metadata.IModel CreateModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder conventionSetBuilder, Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator validator);
abstract member CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
Protected Overridable Function CreateModel (context As DbContext, conventionSetBuilder As IConventionSetBuilder, validator As IModelValidator) As IModel

参数

context
DbContext

为其生成模型的上下文。

conventionSetBuilder
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder

创建模型时要使用的约定集。

validator
IModelValidator

用于验证模型是否可以成功与上下文一起使用的验证程序。

返回

要使用的模型。

适用于

CreateModel(DbContext, IConventionSetBuilder, IModelValidator)

创建模型。 在缓存中找不到模型时,将调用此方法。

protected virtual Microsoft.EntityFrameworkCore.Metadata.IModel CreateModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder conventionSetBuilder, Microsoft.EntityFrameworkCore.Internal.IModelValidator validator);
abstract member CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Internal.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.CreateModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Internal.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
Protected Overridable Function CreateModel (context As DbContext, conventionSetBuilder As IConventionSetBuilder, validator As IModelValidator) As IModel

参数

context
DbContext

为其生成模型的上下文。

conventionSetBuilder
Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder

创建模型时要使用的约定集。

validator
Microsoft.EntityFrameworkCore.Internal.IModelValidator

用于验证模型是否可以成功与上下文一起使用的验证程序。

返回

要使用的模型。

适用于