-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Incorrect simple join table determination in reverse engineering leads to incorrect code generation #28905
Comments
Referencing FK check shouldn't required ideally. In the presence of FK targeting potential join table, it should create navigations in model which fails navigation check and shouldn't mark entity as join entity. Hence it may not be right fix. Need to investigate why navigations are not assigned for the FK. |
Note from triage: it should be possible to work around this issue in EF7 by editing the T4 template used to generate the entity types. |
Patch? At least EF Core 8? |
@ErikEJ It's been this way since 6, right? If so, then it doesn't meet the bar to patch. |
Fair enough. And Power Tools let's you work around it |
The current simple join table determination in version 6 and 7 does not take into account the join table with referencing forgein key(s), resulting in incorrectly generated code.
6.*
efcore/src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs
Line 1148 in 7d0a885
7.*
efcore/src/EFCore.Design/Extensions/ScaffoldingModelExtensions.cs
Line 22 in 376bd8b
Microsoft sql db script
code generated
As you can see
I would like to submit a PR fixing the problem as I have already experimented with it locally and fixed it adding a referencing foreign keys check.
Is there anything I should consider before submitting??
The text was updated successfully, but these errors were encountered: