question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 identifying MemberInfo.
  • Rename GetContainingPrimaryKey to FindContainingPrimaryKey.
  • 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 explicit ConfigurationSource 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 vs IProperty vs string vs PropertyInfo)
  • Add provider-specific extension methods for convention metadata interfaces.
  • Rename and move RelationalAnnotations and RelationalAnnotationsBuilder 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 on ConventionSet
  • Add methods to add/remove a convention to/from all appropriate convention lists.
  • Add a Conventions property of ConventionSetBuilder type to ModelConfigurationBuilder with methods to add/remove a convention

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:31
  • Comments:24 (15 by maintainers)

github_iconTop GitHub Comments

4reactions
AndriySvyrydcommented, Jul 28, 2020

@Saibamen No, we don’t plan to ship this in EF Core 5.0

3reactions
ajcvickerscommented, Oct 28, 2021

@IanKemp Yes, some chance.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found