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

类

名称 说明
AssociationInverseDiscoveryConvention

当相关类型之间仅存在一对导航属性时,检测相互反转的导航属性的约定。

AttributeToColumnAnnotationConvention<TAttribute,TAnnotation>

Code First 约定的常规用途类,用于读取.NET属性中的属性,并根据这些属性生成列注释。

AttributeToTableAnnotationConvention<TAttribute,TAnnotation>

Code First 约定的常规用途类,用于从.NET类型读取属性,并基于这些属性生成表注释。

ColumnAttributeConvention

处理在模型中的属性上找到的 ColumnAttribute 实例的约定

ColumnOrderingConvention

应用通过 ColumnAttribute 或 API 指定的列排序的 DbModelBuilder 约定。

ColumnOrderingConventionStrict

应用通过 ColumnAttribute 或 API 指定的列排序的 DbModelBuilder 约定。 如果检测到重复配置的列顺序,则此约定将引发。

ColumnTypeCasingConvention

用于通过数据注释或 DbModelBuilder API 显式指定的任何数据类型转换为小写的约定。 默认的 SqlClient 提供程序区分大小写,并且要求数据类型为小写。 此约定允许 System.ComponentModel.DataAnnotations.ColumnAttrbiute 和 DbModelBuilder API 不区分大小写。

ComplexTypeAttributeConvention

处理在模型中的类型上找到的 ComplexTypeAttribute 实例的约定。

ComplexTypeDiscoveryConvention

如果类型没有主键、没有映射基类型和导航属性,则将其配置为复杂类型的约定。

ConcurrencyCheckAttributeConvention

处理在模型中的属性上找到的 ConcurrencyCheckAttribute 实例的约定。

Convention

不替代配置的约定。

DatabaseGeneratedAttributeConvention

处理在模型中的属性上找到的 DatabaseGeneratedAttribute 实例的约定。

DecimalPropertyConvention

将精度设置为 18 并将小数位数设置为 2 的约定。

DeclaredPropertyOrderingConvention

要首先显示主键属性的约定。

ForeignKeyAssociationMultiplicityConvention

根据外键属性的 CLR 可为 null 性区分可选关系和必需关系的约定。

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

将依赖实体类型的主键(s)配置为一对一关系中的外键的约定。

PluralizingEntitySetNameConvention

将实体集名称设置为实体类型名称的复数版本约定。

PluralizingTableNameConvention

将表名称设置为实体类型名称的复数版本约定。

PrimaryKeyNameForeignKeyDiscoveryConvention

用于发现其名称与主体类型主键属性名称(s)匹配的外键属性的约定。

PrimitivePropertyAttributeConfigurationConvention<TAttribute>

处理在模型中基元属性上找到的 CLR 属性的约定的基类。

PropertyAttributeConfigurationConvention<TAttribute>

处理在模型中的类型属性上找到 CLR 属性的约定的基类。

PropertyMaxLengthConvention

为类型支持长度分面的属性设置最大长度的约定。 默认值为 128。

RequiredNavigationPropertyAttributeConvention

处理模型中导航属性上找到的 RequiredAttribute 实例的约定。

RequiredPrimitivePropertyAttributeConvention

处理模型中基元属性上找到的 RequiredAttribute 实例的约定。

SqlCePropertyMaxLengthConvention

对于当 SqlCe 是提供程序时,其类型支持长度分面的属性的默认最大长度为 4000 的约定。

StoreGeneratedIdentityKeyConvention

将整数主键配置为标识的约定。

StringLengthAttributeConvention

处理在模型中的属性上找到的 StringLengthAttribute 实例的约定。

TableAttributeConvention

处理在模型中的类型上找到的 TableAttribute 实例的约定。

TimestampAttributeConvention

处理在模型中的属性上找到的 TimestampAttribute 实例的约定。

TypeAttributeConfigurationConvention<TAttribute>

处理模型中找到的 CLR 属性的约定的基类。

TypeNameForeignKeyDiscoveryConvention

用于发现其名称是主体类型名称和主体类型主键属性名称的组合的外键属性的约定。

接口

名称 说明
IConceptualModelConvention<T>

在创建模型后对模型的概念部分进行操作的约定。

IConvention

标识可以在实例中添加或删除的 DbModelBuilder 约定。

IStoreModelConvention<T>

在创建模型后对模型的数据库部分进行操作的约定。