Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Just what are the conventions of the ODataConventionModelBuilder?

There are lots of examples of using ODataConventionModelBuilder with simple, contrived models, often just a single class.

But there's nothing that actually explains what the conventions are; how to code a model that complies with convention. There's no official documentation for it.

So what's the convention?

like image 247
Luke Puplett Avatar asked Sep 29 '22 01:09

Luke Puplett


1 Answers

From what I've seen so far, the conventions are those used by Entity Framework, as opposed to any new ones for OData. Please correct me if I am wrong.

More on Code-first conventions, below, but there are many more in the Julie Lerman book I have yet I cannot find an exhaustive list of them on the web.

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

Update

The EF modelling conventions system is pluggable and each convention is represented by a class encapsulating the behaviour, and those classes are listed here:

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

However that doesn't help with which ones are applicable or used by the ODataConventionModelBuilder if any.

  • AssociationInverseDiscoveryConvention - Provides convention to detect navigation properties to be inverses of each other when only one pair of navigation properties exists between the related types.
  • AttributeToColumnAnnotationConvention - A general purpose class for Code First conventions that read attributes from .NET properties and generate column annotations based on those attributes.
  • AttributeToTableAnnotationConvention - A general purpose class for Code First conventions that read attributes from .NET types and generate table annotations based on those attributes.
  • ColumnAttributeConvention - Represents a convention to process instances of ColumnAttribute found on properties in the model.
  • ColumnOrderingConvention - Represents a convention to apply column ordering specified via ColumnAttribute or theDbModelBuilder API.
  • ColumnOrderingConventionStrict - Convention to apply column ordering specified via ColumnAttribute or theDbModelBuilder API. This convention throws if a duplicate configured column order is detected.
  • ComplexTypeAttributeConvention - Represents the convention to process instances of ComplexTypeAttribute found on types in the model.
  • ComplexTypeDiscoveryConvention - Represents a convention to configure a type as a complex type if it has no primary key, no mapped base type and no navigation properties.
  • ConcurrencyCheckAttributeConvention - Represents the convention to process instances of ConcurrencyCheckAttributefound on properties in the model.
  • Convention - A convention that doesn't override configuration.
  • DatabaseGeneratedAttributeConvention - Represents a convention to process instances of DatabaseGeneratedAttribute found on properties in the model.
  • DecimalPropertyConvention - Convention to set precision to 18 and scale to 2 for decimal properties.
  • DeclaredPropertyOrderingConvention - Represents a convention to move primary key properties to appear first.
  • ForeignKeyAssociationMultiplicityConvention - Represents a convention to distinguish between optional and required relationships based on CLR nullability of the foreign key property.
  • ForeignKeyDiscoveryConvention - Represents a base class for conventions that discover foreign key properties.
  • ForeignKeyIndexConvention - Represents a convention to introduce indexes for foreign keys.
  • ForeignKeyNavigationPropertyAttributeConvention - Represents a convention to process instances of ForeignKeyAttribute found on navigation properties in the model.
  • ForeignKeyPrimitivePropertyAttributeConvention - Represents a convention to process instances of ForeignKeyAttribute found on foreign key properties in the model.
  • IdKeyDiscoveryConvention - Convention to detect primary key properties. Recognized naming patterns in order of precedence are: 1. 'Id' 2. [type name]Id Primary key detection is case insensitive.
  • IndexAttributeConvention - A convention for discovering IndexAttributeattributes on properties and generatingIndexAnnotation column annotations in the model.
  • InversePropertyAttributeConvention - Represents a convention to process instances of InversePropertyAttribute found on properties in the model.
  • KeyAttributeConvention - Convention to process instances ofKeyAttribute found on properties in the model.
  • KeyDiscoveryConvention - Represents a base class for conventions that discover primary key properties.
  • ManyToManyCascadeDeleteConvention - Convention to add a cascade delete to the join table from both tables involved in a many to many relationship.
  • MappingInheritedPropertiesSupportConvention - Convention to ensure an invalid/unsupported mapping is not created when mapping inherited properties
  • MaxLengthAttributeConvention - Represents a convention to process instances of MaxLengthAttribute found on properties in the model.
  • NavigationPropertyNameForeignKeyDiscoveryConvention - Convention to discover foreign key properties whose names are a combination of the dependent navigation property name and the principal type primary key property name(s).
  • NotMappedPropertyAttributeConvention - Represents a convention to process instances of NotMappedAttribute found on properties in the model.
  • NotMappedTypeAttributeConvention - Represents a convention to process instances of NotMappedAttribute found on types in the model.
  • OneToManyCascadeDeleteConvention - Provides a convention to enable cascade delete for any required relationships.
  • OneToOneConstraintIntroductionConvention - Provides a convention to configure the primary key(s) of the dependent entity type as foreign key(s) in a one:one relationship.
  • PluralizingEntitySetNameConvention - Represents a convention to set the entity set name to be a pluralized version of the entity type name.
  • PluralizingTableNameConvention - Represents a convention to set the table name to be a pluralized version of the entity type name.
  • PrimaryKeyNameForeignKeyDiscoveryConvention - Convention to discover foreign key properties whose names match the principal type primary key property name(s).
  • PrimitivePropertyAttributeConfigurationConvention - Base class for conventions that process CLR attributes found on primitive properties in the model.
  • PropertyAttributeConfigurationConvention - Base class for conventions that process CLR attributes found on properties of types in the model.
  • PropertyMaxLengthConvention - Represents a convention to set a maximum length for properties whose type supports length facets. The default value is 128.
  • RequiredNavigationPropertyAttributeConvention - Convention to process instances ofRequiredAttribute found on navigation properties in the model.
  • RequiredPrimitivePropertyAttributeConvention - Represents a convention to process instances of RequiredAttribute found on primitive properties in the model.
  • SqlCePropertyMaxLengthConvention - Represents a convention to set a default maximum length of 4000 for properties whose type supports length facets when SqlCe is the provider.
  • StoreGeneratedIdentityKeyConvention - Represents a convention to configure integer primary keys to be identity.
  • StringLengthAttributeConvention - Represents a convention to process instances of StringLengthAttribute found on properties in the model.
  • TableAttributeConvention - Represents a convention to process instances of TableAttribute found on types in the model.
  • TimestampAttributeConvention - Represents a convention to process instances of TimestampAttribute found on properties in the model.
  • TypeAttributeConfigurationConvention - Base class for conventions that process CLR attributes found in the model.
  • TypeNameForeignKeyDiscoveryConvention - Convention to discover foreign key properties whose names are a combination of the principal type name and the principal type primary key property name(s).
like image 80
Luke Puplett Avatar answered Oct 05 '22 06:10

Luke Puplett