System.Data.Entity.ModelConfiguration.Conventions 命名空間

類別

名稱 Description
AssociationInverseDiscoveryConvention

當相關類型之間僅有一對導航性質時,將導航性質偵測為彼此的逆。

AttributeToColumnAnnotationConvention<TAttribute,TAnnotation>

一個通用的 Code First 慣例類別,能從 .NET 屬性讀取屬性,並根據這些屬性產生欄位註解。

AttributeToTableAnnotationConvention<TAttribute,TAnnotation>

一個通用的 Code First 慣例類別,能從 .NET 類型讀取屬性並根據這些屬性產生資料表註解。

ColumnAttributeConvention

處理模型中屬性上的 實例ColumnAttribute

ColumnOrderingConvention

慣例是透過 API 指定的ColumnAttributeDbModelBuilder欄位排序。

ColumnOrderingConventionStrict

慣例是透過 API 指定的ColumnAttributeDbModelBuilder欄位排序。 若偵測到欄位順序重複,則會拋棄此慣例。

ColumnTypeCasingConvention

慣例是將任何透過資料註解或 DbModelBuilder API 明確指定的資料型態轉換為小寫。 預設的 SqlClient 提供者是大小寫區分的,且要求資料型別必須是小寫。 此慣例使 System.ComponentModel.DataAnnotations.ColumnAttrbiute 和 DbModelBuilder API 不區分大小寫。

ComplexTypeAttributeConvention

在模型中處理 在 ComplexTypeAttribute 型別上的實例。

ComplexTypeDiscoveryConvention

若該類型沒有主鍵、沒有映射基底類型且沒有導航屬性,則該慣例將該類型配置為複雜型態。

ConcurrencyCheckAttributeConvention

用來處理模型中屬性上的 實例 ConcurrencyCheckAttribute 。

Convention

一個不會覆蓋設定的慣例。

DatabaseGeneratedAttributeConvention

用來處理模型中屬性上的 實例 DatabaseGeneratedAttribute 。

DecimalPropertyConvention

慣例是將精度設為 18,並以 2 來處理十進位屬性。

DeclaredPropertyOrderingConvention

慣例是將主要鍵屬性移到最前面。

ForeignKeyAssociationMultiplicityConvention

用以區分基於外鍵屬性 CLR 空性而區分可選關係與必需關係的慣例。

ForeignKeyDiscoveryConvention

用於發現外鍵屬性的慣例基底類別。

ForeignKeyIndexConvention

引入外鍵索引的慣例。

ForeignKeyNavigationPropertyAttributeConvention

慣例用來處理模型中導航屬性上的 發現實例 ForeignKeyAttribute 。

ForeignKeyPrimitivePropertyAttributeConvention

處理模型中外鍵屬性上的實例 ForeignKeyAttribute 。

IdKeyDiscoveryConvention

用來偵測主要鍵屬性的慣例。 公認的命名模式依優先順序有:

  1. 'Id'
  2. [類型名稱]ID 主鍵偵測不區分大小寫。
IndexAttributeConvention

一種用於發現 IndexAttribute 屬性及產生 IndexAnnotation 模型欄位註解的慣例。

InversePropertyAttributeConvention

用來處理模型中屬性上的 實例 InversePropertyAttribute 。

KeyAttributeConvention

用來處理模型中屬性上的 實例 KeyAttribute 。

KeyDiscoveryConvention

用於發現主要鍵屬性的慣例基底類別。

ManyToManyCascadeDeleteConvention

慣例是從涉及多對多關係的兩個資料表中,向連接表加入串聯刪除。

MappingInheritedPropertiesSupportConvention

確保在映射繼承屬性時不會產生無效或不支援的映射慣例

MaxLengthAttributeConvention

用來處理模型中屬性上的 實例 MaxLengthAttribute 。

NavigationPropertyNameForeignKeyDiscoveryConvention

用來發現外鍵屬性的慣例,其名稱由依賴的導覽屬性名稱與主型別(主鍵屬性名稱)組合而成。

NotMappedPropertyAttributeConvention

用來處理模型中屬性上的 實例 NotMappedAttribute 。

NotMappedTypeAttributeConvention

在模型中處理 在 NotMappedAttribute 型別上的實例。

OneToManyCascadeDeleteConvention

慣例可啟用串聯刪除,適用於任何必要的關聯。

OneToOneConstraintIntroductionConvention

慣例是將相依實體類型的主鍵配置為外鍵,並以一對一的關係。

PluralizingEntitySetNameConvention

將實體集合名稱設定為實體類型名稱的複數版本。

PluralizingTableNameConvention

慣例是將表格名稱設定為實體類型名稱的複數版本。

PrimaryKeyNameForeignKeyDiscoveryConvention

用來發現名稱與主鍵屬性相符的外鍵屬性的慣例:主鍵屬性名稱。

PrimitivePropertyAttributeConfigurationConvention<TAttribute>

基底類別用於處理模型中原始屬性上的 CLR 屬性。

PropertyAttributeConfigurationConvention<TAttribute>

基底類別用於處理模型中型別屬性上的 CLR 屬性的慣例。

PropertyMaxLengthConvention

慣例為支援長度面的屬性設定最大長度。 預設值是128。

RequiredNavigationPropertyAttributeConvention

慣例用來處理模型中導航屬性上的 發現實例 RequiredAttribute 。

RequiredPrimitivePropertyAttributeConvention

用來處理模型中原始屬性上的 實 RequiredAttribute 例。

SqlCePropertyMaxLengthConvention

慣例是將支援長度面的屬性預設最大長度設為 4000,當 SqlCe 為提供者時。

StoreGeneratedIdentityKeyConvention

將整數主鍵設定為身份的慣例。

StringLengthAttributeConvention

用來處理模型中屬性上的 實例 StringLengthAttribute 。

TableAttributeConvention

在模型中處理 在 TableAttribute 型別上的實例。

TimestampAttributeConvention

用來處理模型中屬性上的 實例 TimestampAttribute 。

TypeAttributeConfigurationConvention<TAttribute>

基底類別用於處理模型中 CLR 屬性的慣例。

TypeNameForeignKeyDiscoveryConvention

用來發現名稱由主鍵類型名稱與主類型主鍵屬性名稱組合而成的外鍵屬性的慣例。

介面

名稱 Description
IConceptualModelConvention<T>

模型建立後,概念區段運作的慣例。

IConvention

識別可新增或移除實 DbModelBuilder 例的慣例。

IStoreModelConvention<T>

一個在模型建立後,對資料庫區段運作的慣例。