語言

ConventionSet 類別

定義

代表一組用於建構模型的慣例。

public class ConventionSet
[System.Runtime.CompilerServices.Nullable(0)]
public class ConventionSet
type ConventionSet = class
[<System.Runtime.CompilerServices.Nullable(0)>]
type ConventionSet = class
Public Class ConventionSet
繼承
ConventionSet
屬性

備註

更多資訊與範例請參閱 模型建構慣例 。

建構函式

名稱 Description
ConventionSet()

代表一組用於建構模型的慣例。

屬性

名稱 Description
BaseEntityTypeChangedConventions

當基礎實體類型變更時執行的慣例。

BaseEntityTypeSetConventions

當設定或移除基底實體類型時執行的慣例。

ComplexPropertyAddedConventions

當實體類型加入模型時執行的慣例。

ComplexPropertyAnnotationChangedConventions

當對複雜屬性設定或移除註解時執行的慣例。

ComplexPropertyFieldChangedConventions

當屬性欄位變更時執行的慣例。

ComplexPropertyNullabilityChangedConventions

當屬性的可取消性改變時執行的慣例。

ComplexPropertyRemovedConventions

當實體類型被移除時執行的慣例。

ComplexTypeAnnotationChangedConventions

當對複雜型別設定或移除註解時執行的慣例。

ComplexTypeMemberIgnoredConventions

當某個屬性被忽略時,應該執行的慣例。

DiscriminatorPropertySetConventions

當判別器屬性被設定時執行的慣例。

ElementTypeAnnotationChangedConventions

當集合元素的註解被更改時執行的慣例。

ElementTypeNullabilityChangedConventions

當集合元素的可行性改變時執行的慣例。

EntityTypeAddedConventions

當實體類型加入模型時執行的慣例。

EntityTypeAnnotationChangedConventions

當對實體類型設定或移除註解時執行的慣例。

EntityTypeAnnotationSetConventions

當對實體類型設定或移除註解時執行的慣例。

EntityTypeBaseTypeChangedConventions

當基礎實體類型變更時執行的慣例。

EntityTypeIgnoredConventions

當忽略某個實體類型時執行的慣例。

EntityTypeMemberIgnoredConventions

當某個屬性被忽略時,應該執行的慣例。

EntityTypePrimaryKeyChangedConventions

當主鍵變更時執行的慣例。

EntityTypeRemovedConventions

當實體類型被移除時執行的慣例。

ForeignKeyAddedConventions

新增外鍵時執行的慣例。

ForeignKeyAnnotationChangedConventions

當外鍵註解被更改時執行的慣例。

ForeignKeyConstrainednessChangedConventions

當外鍵的約束性改變時,執行慣例。

ForeignKeyDependentRequirednessChangedConventions

當外金鑰需求改變時,會執行慣例。

ForeignKeyNullNavigationSetConventions

當導航設定為 null 外鍵時執行的慣例。

ForeignKeyOwnershipChangedConventions

當外金鑰所有權變更時,執行的慣例。

ForeignKeyPrincipalEndChangedConventions

當關係的主要端點被設定時,會執行的約定。

ForeignKeyPropertiesChangedConventions

當外鍵的屬性或主鍵被更改時,執行的慣例。

ForeignKeyRemovedConventions

當外鍵被移除時執行的慣例。

ForeignKeyRequirednessChangedConventions

當外金鑰需求改變時,會執行慣例。

ForeignKeyUniquenessChangedConventions

當外金鑰唯一性改變時,執行的慣例。

ForeignKeyUniquenessConventions

當外金鑰唯一性改變時,執行的慣例。

IndexAddedConventions

新增索引時執行的慣例。

IndexAnnotationChangedConventions

索引上註解變更時執行的慣例。

IndexRemovedConventions

移除索引時執行的慣例。

IndexSortOrderChangedConventions

當索引排序順序改變時執行的慣例。

IndexUniquenessChangedConventions

當索引唯一性改變時執行的慣例。

IndexUniquenessConventions

當索引唯一性改變時執行的慣例。

KeyAddedConventions

加入鍵時執行的慣例。

KeyAnnotationChangedConventions

當鍵上註解被更改時執行的慣例。

KeyRemovedConventions

當金鑰被移除時執行的慣例。

ModelAnnotationChangedConventions

當模型上設定或移除註解時執行的慣例。

ModelBuiltConventions

模型製作完成後應舉辦的會議。

ModelEmbeddedDiscriminatorNameConventions

當對實體類型設定或移除註解時執行的慣例。

ModelFinalizedConventions

模型驗證完成後執行的慣例。

ModelFinalizingConventions

模型製作完成後應舉辦的會議。

ModelInitializedConventions

要執行一些約定來建立初始模型。

NavigationAddedConventions

新增導航屬性時執行的慣例。

NavigationAnnotationChangedConventions

當導航屬性的註解被更改時執行的慣例。

NavigationRemovedConventions

當導航屬性被移除時,執行的慣例。

PrimaryKeyChangedConventions

當主鍵變更時執行的慣例。

PrimaryKeySetConventions

設定主鍵時執行的慣例。

PrincipalEndChangedConventions

當關係的主要端點被設定時,會執行的約定。

PrincipalEndSetConventions

當關係的主要端點被設定時,會執行的約定。

PropertyAddedConventions

新增屬性時執行的慣例。

PropertyAnnotationChangedConventions

當屬性上註解被更改時執行的慣例。

PropertyAutoLoadChangedConventions

當屬性的自動載入值改變時執行的慣例。

PropertyElementTypeChangedConventions

當屬性欄位變更時執行的慣例。

PropertyFieldChangedConventions

當屬性欄位變更時執行的慣例。

PropertyNullabilityChangedConventions

當屬性的可取消性改變時執行的慣例。

PropertyNullableChangedConventions

當屬性的可取消性改變時執行的慣例。

PropertyRemovedConventions

物件移除時執行的慣例。

SkipNavigationAddedConventions

新增跳過導覽屬性時執行的慣例。

SkipNavigationAnnotationChangedConventions

跳過導覽屬性中註解變更時執行的慣例。

SkipNavigationForeignKeyChangedConventions

當跳過導覽外鍵被更改時執行的慣例。

SkipNavigationInverseChangedConventions

當跳過導覽反元改變時執行的慣例。

SkipNavigationRemovedConventions

當移除跳過導覽屬性時執行的慣例。

TriggerAddedConventions

在加入觸發屬性時執行的慣例。

TriggerRemovedConventions

當觸發屬性被移除時執行的慣例。

TypeIgnoredConventions

當某類型被忽略時執行的慣例。

方法

名稱 Description
Add(IConvention)

為集合加入慣例。

AddAfter<TConvention>(IList<TConvention>, TConvention, Type)

在現有約定之後再加一個約定。

AddAfter<TConvention>(List<TConvention>, TConvention, Type)

在現有約定之後再加一個約定。

AddBefore<TConvention>(IList<TConvention>, TConvention, Type)

在現有約定之前加入一個約定。

AddBefore<TConvention>(List<TConvention>, TConvention, Type)

在現有約定之前加入一個約定。

CreateConventionSet(DbContext)

呼叫此方法,當使用ModelBuilder外部OnModelCreating(ModelBuilder)時,僅為核心服務建置 。ConventionSet

請注意,使用此方法並不常見。 考慮用正常方式使用 DbContext 。

Remove(Type)

移除該類型的慣例。

Remove<TConvention>(IList<TConvention>, Type)

移除現有的慣例。

Remove<TConvention>(List<TConvention>, Type)

移除現有的慣例。

Replace<TConvention,TImplementation>(IList<TConvention>, TImplementation)

用衍生慣例取代現有慣例。

Replace<TConvention,TImplementation>(List<TConvention>, TImplementation)

用衍生慣例取代現有慣例。

Replace<TImplementation>(TImplementation)

用衍生慣例取代現有慣例。 同時註冊任何未被現有慣例實作的慣例類型。

適用於