You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide more many-to-many mapping examples, including with explicitly mapped join entities #3648
changed the title [-]Examples in how to do many to many joins in EF Core 6[/-][+]Provide more many-to-many mapping examples, including with explicitly mapped join entities[/+]on Jan 10, 2022
Sadly upgrading to EF 6 is more of a hassle thanks to this 😕 Our model is crawling with many to many relationships and we do database first reverse engineer with EF Core Power Tools every other day. Is there any benefit of doing explicit joins?
I'm really considering staying with EF 5.
Activity
ajcvickers commentedon Jan 3, 2022
@blogcraft If you want to use explicit joins, then map the join table to an entity type and proceed as before.
blogcraft commentedon Jan 3, 2022
Thanks for the response! But I didn't understand. (Sorry 😅) Can I get a code example?
ajcvickers commentedon Jan 10, 2022
@blogcraft For example, with a many-to-many between posts and tags:
Create an entity type for the join table:
And map it:
Now use it in your queries as before:
[-]Examples in how to do many to many joins in EF Core 6[/-][+]Provide more many-to-many mapping examples, including with explicitly mapped join entities[/+]blogcraft commentedon Jan 12, 2022
Thanks for the example, I'll give it a shot!
Sadly upgrading to EF 6 is more of a hassle thanks to this 😕 Our model is crawling with many to many relationships and we do database first reverse engineer with EF Core Power Tools every other day. Is there any benefit of doing explicit joins?
I'm really considering staying with EF 5.
ErikEJ commentedon Jan 12, 2022
@blogcraft not sure if it is relevant but EF Core Power Tools has an option to generate join Entities with EF Core 6.
blogcraft commentedon Jan 12, 2022
@ErikEJ Thanks a lot! It was exactly what I needed.
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation
Major overhaul of the "relationships" documentation