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

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

System.Data.Entity.ModelConfiguration.Conventions 命名空间包含描述一组规则的类,在使用 Code First 时,这些规则用于自动基于类定义配置概念模型。

  描述
公共类 AssociationInverseDiscoveryConvention 提供用于在相关类型之间只存在一对导航属性时,将导航属性检测为相互反向的约定。
公共类 AttributeToColumnAnnotationConvention<TAttribute, TAnnotation> 从 .NET 属性 (Property) 读取属性 (Attribute) 并根据这些属性 (Attribute) 生成列注释的 Code First 约定的通用类。
公共类 AttributeToTableAnnotationConvention<TAttribute, TAnnotation> 从 .NET 类型读取属性并根据这些属性生成表注释的 Code First 约定的通用类。
公共类 ColumnAttributeConvention 表示用于处理模型中属性上找到的 ColumnAttribute 实例的约定。
公共类 ColumnOrderingConvention 表示通过 ColumnAttributeDbModelBuilder API 应用指定的列排序的约定。
公共类 ColumnOrderingConventionStrict 用于应用通过 ColumnAttributeDbModelBuilder 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。[type name]Id。主键检测不区分大小写。
公共类 IndexAttributeConvention 用于发现属性 (Property) 上的 IndexAttribute 属性 (Attribute),以及在模型中生成 IndexAnnotation 列注释的约定。
公共类 InversePropertyAttributeConvention 表示用于处理模型中属性上找到的 InversePropertyAttribute 实例的约定。
公共类 KeyAttributeConvention 用于处理在模型中属性上发现的 KeyAttribute 实例的约定。
公共类 KeyDiscoveryConvention 表示发现主键属性的约定的基类。
公共类 ManyToManyCascadeDeleteConvention 用于将级联删除从多对多关系中涉及的两个表添加到联接表的约定。
公共类 MappingInheritedPropertiesSupportConvention 确保在映射继承的属性时不创建无效/不支持的映射的约定
公共类 MaxLengthAttributeConvention 表示用于处理模型中属性上找到的 MaxLengthAttribute 实例的约定。
公共类 NavigationPropertyNameForeignKeyDiscoveryConvention 用于发现名称是从属导航属性名称和主体类型主键属性名称组合的外键属性的约定。
公共类 NotMappedPropertyAttributeConvention 表示用于处理模型中属性上找到的 NotMappedAttribute 实例的约定。
公共类 NotMappedTypeAttributeConvention 表示用于处理在模型中类型上发现的 NotMappedAttribute 实例的约定。
公共类 OneToManyCascadeDeleteConvention 提供用于为任何必需关系启用级联删除的约定。
公共类 OneToOneConstraintIntroductionConvention 提供用于将从属实体类型的主键配置为一对一关系中外键的约定。
公共类 PluralizingEntitySetNameConvention 表示用于将实体集名称设置为实体类型名称的复数版本的约定。
公共类 PluralizingTableNameConvention 表示用于将表名称设置为实体类型名称的复数版本的约定。
公共类 PrimaryKeyNameForeignKeyDiscoveryConvention 用于发现名称与主体类型主键属性名称匹配的外键属性的约定。
公共类 PrimitivePropertyAttributeConfigurationConvention<TAttribute> 用于处理在模型的基元属性 (Property) 中找到的 CLR 属性 (Attribute) 的约定的基类。
公共类 PropertyAttributeConfigurationConvention<TAttribute> 用于处理在模型的类型属性 (Property) 中找到的 CLR 属性 (Attribute) 的约定的基类。
公共类 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> 在创建模型后对模型的数据库部分执行操作的约定。