-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for pre-convention model configuration #3533
Conversation
609a00b
to
6c8b620
Compare
6c8b620
to
299cc2b
Compare
### Drawbacks of the Metadata API | ||
|
||
- Unlike Fluent API, every modification to the model needs to be done explicitly. For example, if some of the `Money` properties were configured as navigations by a convention then you need to first remove the navigation referencing the CLR property before adding an entity type property for it. [#9117](https://github.com/dotnet/efcore/issues/9117) will improve this. | ||
- The conventions run after each change. If you remove a navigation discovered by a convention then the convention will run again and add it back. To prevent this from happening you would need to either delay the conventions until after the property is added by calling <xref:Microsoft.EntityFrameworkCore.Metadata.Conventions.IConventionContext.DelayConventions> or to mark the CLR property as ignored using <xref:Microsoft.EntityFrameworkCore.Metadata.IMutableModel.AddIgnored%2A>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt many would understand what this means 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem, the solution or both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both. To be clear, this isn't about your text or anything - it's just that understanding the reactivity of conventions and what that could mean is a very advanced, internal thing.
Maybe it's better to go with something vague, just to convey the "unreliability" of this mechanism (e.g. "Some changes done via the Fluent API may not result in the desired results. For example, if you remove a navigation discovered by a convention, then that convention will run again and add it back."). Otherwise we could go with this too - I just doubt it would help many people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll expand and move this in #1937
8ccc738
to
ace21aa
Compare
ace21aa
to
bce7cd9
Compare
bce7cd9
to
60a8b6e
Compare
Part of #3278
Fixes #571