ModelSource.CreateModel 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
CreateModel(DbContext, IConventionSetBuilder) |
已淘汰.
已淘汰.
建立模型。 在快取中找不到模型時,會呼叫這個方法。 |
CreateModel(DbContext, IConventionSetBuilder, ModelDependencies) |
建立模型。 在快取中找不到模型時,會呼叫這個方法。 |
CreateModel(DbContext, IConventionSetBuilder, IModelValidator) |
建立模型。 在快取中找不到模型時,會呼叫這個方法。 |
CreateModel(DbContext, IConventionSetBuilder, IModelValidator) |
建立模型。 在快取中找不到模型時,會呼叫這個方法。 |
CreateModel(DbContext, IConventionSetBuilder)
警告
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)
建立模型。 在快取中找不到模型時,會呼叫這個方法。
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
模型的相依性物件。
傳回
要使用的模型。
適用於
CreateModel(DbContext, IConventionSetBuilder, IModelValidator)
建立模型。 在快取中找不到模型時,會呼叫這個方法。
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
驗證程式,驗證模型可以成功與內容搭配使用。
傳回
要使用的模型。