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

模型的相依性物件。

備註

如需詳細資訊和範例,請參閱 模型化實體類型和關聯性和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
屬性

適用於