Allow applications to create model building conventions (aka public conventions)
See original GitHub issue- Create public interfaces for metadata API to be used by conventions.
- Change
QueryFilter
,DefiningQuery
,IsEagerLoaded
,IsShadowProperty
,IsIndexedProperty
,BeforeSaveBehavior
AfterSaveBehavior
to extension methods. - Throw when calling
SetField
would change the shadowness of a property or the name of the identifyingMemberInfo
. - Rename
GetContainingPrimaryKey
toFindContainingPrimaryKey
. - Throw when calling
SetField
on a shadow or a field-only property. - Create public interfaces that the internal model builders implement, e.g.
IConventionModelBuilder
. This will allow cleaner API, without the explicitConfigurationSource
parameter. - Throw instead of silently failing when a non-explicit configuration call is invalid. This would require adding quiz API (‘CanSet’).
- Make model element references consistent (e.g.
Property
vsIProperty
vsstring
vsPropertyInfo
) - Add provider-specific extension methods for convention metadata interfaces.
- Rename and move
RelationalAnnotations
andRelationalAnnotationsBuilder
to Core. - Remove unused methods on provider classes like
SqlServerPropertyBuilderAnnotations.ColumnName
. - Rename the
Apply
methods to be more descriptive and make the return types consistent, still allowing to stop the execution of the following conventions. - Pass
CoreConventionSetBuilderDependencies
to the constructor of all conventions. - Add convention type for configuring a type as owned and use it to remove ambiguous ownerships.
- Track the model elements as they are modified by conventions, so a call to a convention never returns an element that is no longer in the model.
- Add a way to delay the convention execution.
- Move logic from
ModelCustomizer
to a convention. - Add
SqlServerValueGenerationStrategy.None
value that can be used to override the model default. - Filter out the core annotations changes from conventions.
- Remove
PropertyMetadataChanged()
calls and don’t cache indexes while the model is mutable. - Expose conventions as
List
onConventionSet
- Add methods to add/remove a convention to/from all appropriate convention lists.
- Add a
Conventions
property ofConventionSetBuilder
type toModelConfigurationBuilder
with methods to add/remove a convention
Issue Analytics
- State:
- Created 9 years ago
- Reactions:31
- Comments:24 (15 by maintainers)
Top Results From Across the Web
Creating and Configuring a Model - EF Core
Overview of creating and configuring a Entity Framework Core model via Fluent API, Data Annotations and conventions.
Read more >Model building conventions in Entity Framework Core 7.0
In this article, I will show you one of the new features of EF Core 7 named "Model building conventions".
Read more >Model Bulk Configuration - EF Core
Model building conventions are a powerful way to control the model configuration, but can be complex and hard to get right. In many...
Read more >In EF Core, pre-convention model configuration ...
In EF Core, pre-convention model configuration refers to the configuration of entities and properties before the model is created by EF Core ...
Read more >Simple Code-First Example
Learn how Entity Framework Code-First approach works by creating a simple example in EF 6.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Saibamen No, we don’t plan to ship this in EF Core 5.0
@IanKemp Yes, some chance.