ModelSource.GetModel 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
GetModel(DbContext, IConventionSetBuilder) |
已淘汰.
已淘汰.
從快取傳回模型,如果模型不存在於快取中,則建立模型。 |
GetModel(DbContext, IConventionSetBuilder, ModelDependencies) |
已淘汰.
從快取傳回模型,如果模型不存在於快取中,則建立模型。 |
GetModel(DbContext, IConventionSetBuilder, IModelValidator) |
從快取傳回模型,如果模型不存在於快取中,則建立模型。 |
GetModel(DbContext, IConventionSetBuilder, IModelValidator) |
從快取傳回模型,如果模型不存在於快取中,則建立模型。 |
GetModel(DbContext, ModelCreationDependencies, Boolean) |
取得要使用的模型。 |
GetModel(DbContext, IConventionSetBuilder)
警告
Use the overload with ModelDependencies
警告
Use the overload with ModelCreationDependencies
從快取傳回模型,如果模型不存在於快取中,則建立模型。
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder);
[System.Obsolete("Use the overload with ModelDependencies")]
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder);
[System.Obsolete("Use the overload with ModelCreationDependencies")]
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder);
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
[<System.Obsolete("Use the overload with ModelDependencies")>]
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
[<System.Obsolete("Use the overload with ModelCreationDependencies")>]
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder -> Microsoft.EntityFrameworkCore.Metadata.IModel
Public Overridable Function GetModel (context As DbContext, conventionSetBuilder As IConventionSetBuilder) As IModel
參數
- context
- DbContext
正在產生模型的內容。
- conventionSetBuilder
- IConventionSetBuilder
建立模型時要使用的慣例。
傳回
要使用的模型。
實作
- 屬性
適用於
GetModel(DbContext, IConventionSetBuilder, ModelDependencies)
警告
Use the overload with ModelCreationDependencies
從快取傳回模型,如果模型不存在於快取中,則建立模型。
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder, Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies modelDependencies);
[System.Obsolete("Use the overload with ModelCreationDependencies")]
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder conventionSetBuilder, Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies modelDependencies);
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies -> Microsoft.EntityFrameworkCore.Metadata.IModel
[<System.Obsolete("Use the overload with ModelCreationDependencies")>]
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.ModelDependencies -> Microsoft.EntityFrameworkCore.Metadata.IModel
Public Overridable Function GetModel (context As DbContext, conventionSetBuilder As IConventionSetBuilder, modelDependencies As ModelDependencies) As IModel
參數
- context
- DbContext
正在產生模型的內容。
- conventionSetBuilder
- IConventionSetBuilder
建立模型時要使用的慣例。
- modelDependencies
- ModelDependencies
模型的相依性物件。
傳回
要使用的模型。
實作
- 屬性
適用於
GetModel(DbContext, IConventionSetBuilder, IModelValidator)
從快取傳回模型,如果模型不存在於快取中,則建立模型。
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder conventionSetBuilder, Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator validator);
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Infrastructure.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
Public Overridable Function GetModel (context As DbContext, conventionSetBuilder As IConventionSetBuilder, validator As IModelValidator) As IModel
參數
- context
- DbContext
正在產生模型的內容。
- conventionSetBuilder
- Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder
建立模型時要使用的慣例。
- validator
- IModelValidator
驗證模型可以成功與內容搭配使用驗證程式。
傳回
要使用的模型。
實作
適用於
GetModel(DbContext, IConventionSetBuilder, IModelValidator)
從快取傳回模型,如果模型不存在於快取中,則建立模型。
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder conventionSetBuilder, Microsoft.EntityFrameworkCore.Internal.IModelValidator validator);
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Internal.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.IConventionSetBuilder * Microsoft.EntityFrameworkCore.Internal.IModelValidator -> Microsoft.EntityFrameworkCore.Metadata.IModel
Public Overridable Function GetModel (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
驗證模型可以成功與內容搭配使用驗證程式。
傳回
要使用的模型。
實作
適用於
GetModel(DbContext, ModelCreationDependencies, Boolean)
取得要使用的模型。
public virtual Microsoft.EntityFrameworkCore.Metadata.IModel GetModel (Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.ModelCreationDependencies modelCreationDependencies, bool designTime);
abstract member GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.ModelCreationDependencies * bool -> Microsoft.EntityFrameworkCore.Metadata.IModel
override this.GetModel : Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.ModelCreationDependencies * bool -> Microsoft.EntityFrameworkCore.Metadata.IModel
Public Overridable Function GetModel (context As DbContext, modelCreationDependencies As ModelCreationDependencies, designTime As Boolean) As IModel
參數
- context
- DbContext
正在產生模型的內容。
- modelCreationDependencies
- ModelCreationDependencies
在建立模型期間使用的相依性物件。
- designTime
- Boolean
模型是否應該包含設計階段組態。
傳回
要使用的模型。