2015-01-06 51 views

回答

4

从我迄今看到的,这些约定是实体框架使用的约定,而不是OData的任何新约定。如果我错了,请纠正我。

更多关于代码优先的约定,下面还有更多,但我还没有在Julie Lerman的书中找到他们在网上详尽的列表。

http://blogs.msdn.com/b/efdesign/archive/2010/06/01/conventions-for-code-first.aspx

更新

的EF建模惯例系统是可插拔的,并且每个公约由类封装的特性来表示,并且这些类这里列出:

http://msdn.microsoft.com/en-us/library/system.data.entity.modelconfiguration.conventions(v=vs.113).aspx

但是,如果ODataConventionModelBuilder不适用于哪些适用或使用if任何。

  • AssociationInverseDiscoveryConvention - 提供约定来检测导航属性是彼此的逆,当相关类型之间仅存在一对导航特性。
  • AttributeToColumnAnnotationConvention - Code First惯例的通用类,它从.NET属性中读取属性并根据这些属性生成列注释。
  • AttributeToTableAnnotationConvention - Code First惯例的通用类,它从.NET类型读取属性并根据这些属性生成表格注释。
  • ColumnAttributeConvention - 表示处理在模型中的属性上找到的ColumnAttribute实例的约定。
  • ColumnOrderingConvention - 表示应用通过ColumnAttribute或dbModelBuilder API指定的列排序的约定。
  • ColumnOrderingConventionStrict - 应用通过ColumnAttribute或dbModelBuilder API指定列排序的约定。如果检测到重复配置的列顺序,则会引发此惯例。
  • ComplexTypeAttributeConvention - 表示处理在模型中的类型上找到的ComplexTypeAttribute实例的约定。
  • ComplexTypeDiscoveryConvention - 表示将类型配置为复杂类型(如果它没有主键,没有映射基本类型并且没有导航属性)的约定。
  • ConcurrencyCheckAttributeConvention - 表示在模型中的属性上处理ConcurrencyCheckAttributefound实例的约定。
  • 约定 - 不覆盖配置的约定。
  • DatabaseGeneratedAttributeConvention - 表示处理在模型中的属性上找到的DatabaseGeneratedAttribute实例的约定。
  • DecimalPropertyConvention - 约定将精度设置为18,对于小数属性将比例设置为2。
  • DeclaredPropertyOrderingConvention - 表示主键属性首先出现的约定。
  • ForeignKeyAssociationMultiplicityConvention - 表示基于外键属性的CLR可空性区分可选关系和所需关系的约定。
  • ForeignKeyDiscoveryConvention - 表示发现外键属性的约定的基类。
  • ForeignKeyIndexConvention - 表示引入外键索引的约定。
  • ForeignKeyNavigationPropertyAttributeConvention - 表示处理在模型中的导航属性上找到的ForeignKeyAttribute实例的约定。
  • ForeignKeyPrimitivePropertyAttributeConvention - 表示处理在模型中的外键属性中找到的ForeignKeyAttribute实例的约定。
  • IdKeyDiscoveryConvention - 约定检测主键属性。按优先顺序识别的命名模式为:1.'Id'2. [type name] Id主键检测不区分大小写。
  • IndexAttributeConvention - 用于在模型中发现属性和generateIndexAnnotation列注释的IndexAttributeattributes的约定。
  • InversePropertyAttributeConvention - 表示处理在模型中的属性上找到的InversePropertyAttribute实例的约定。
  • KeyAttributeConvention - 处理在模型中的属性上找到的KeyAttribute实例的约定。
  • KeyDiscoveryConvention - 表示发现主键属性的约定的基类。
  • ManyToManyCascadeDeleteConvention - 约定从多对多关系中涉及的两个表中向连接表添加级联删除。映射继承属性
  • MaxLengthAttributeConvention时未创建约定,以确保无效/不受支持的映射 - -
  • MappingInheritedPropertiesSupportConvention表示惯例来处理MaxLengthAttribute的情况下,模型中的属性中找到。
  • NavigationPropertyNameForeignKeyDiscoveryConvention - 约定发现外键属性的名称是依赖导航属性名称和主体类型主键属性名称的组合。
  • NotMappedPropertyAttributeConvention - 表示处理在模型中的属性中找到的NotMappedAttribute实例的约定。
  • NotMappedTypeAttributeConvention - 表示处理在模型中的类型中找到的NotMappedAttribute实例的约定。
  • OneToManyCascadeDeleteConvention - 提供了一种约定来启用任何所需关系的级联删除。
  • OneToOneConstraintIntroductionConvention - 提供了一种约定,以一对一关系将相关实体类型的主键配置为外键。
  • PluralizingEntitySetNameConvention - 表示将实体集名称设置为实体类型名称的复数版本的约定。
  • PluralizingTableNameConvention - 表示将表名称设置为实体类型名称的复数版本的约定。
  • PrimaryKeyNameForeignKeyDiscoveryConvention - 发现名称与主体类型主键属性名称匹配的外键属性的约定。
  • PrimitivePropertyAttributeConfigurationConvention - 用于处理在模型中的原始属性上找到的CLR属性的约定的基类。
  • PropertyAttributeConConventionConvention - 用于处理在模型中的类型属性上找到的CLR属性的约定的基类。
  • PropertyMaxLengthConvention - 表示为其类型支持长度构面的属性设置最大长度的约定。缺省值为128.
  • RequiredNavigationPropertyAttributeConvention - 处理在模型中的导航属性上找到的RequiredAttribute实例的约定。
  • RequiredPrimitivePropertyAttributeConvention - 表示处理在模型中的原始属性上找到的RequiredAttribute实例的约定。
  • SqlCePropertyMaxLengthConvention - 表示当SqlCe为提供者时,对于其类型支持长度方面的属性,默认最大长度为4000的约定。
  • StoreGeneratedIdentityKeyConvention - 表示将整数主键配置为标识的约定。
  • StringLengthAttributeConvention - 表示处理在模型中的属性上找到的StringLengthAttribute实例的约定。
  • TableAttributeConvention - 表示处理在模型中的类型中找到的TableAttribute实例的约定。
  • TimestampAttributeConvention - 表示处理在模型中的属性上找到的TimestampAttribute实例的约定。
  • TypeAttributeConfigurationConvention - 处理在模型中找到的CLR属性的约定的基类。
  • TypeNameForeignKeyDiscoveryConvention - 约定用于发现名称为主体类型名称和主体类型主键属性名称组合的外键属性。