How to handle Many To Many relationship in Entity Framework

preview_player
Показать описание
In this video i will show you how to handle Many To Many relationship in Entity Framework. It doesnt matter if it is a Blazor Server App or a ASP.NET Core Web App, bacuse this is a job for Entity Framework to handle. And it does handle it extremely simple and in a clean way.

---------------------------------------------------------------------------------------------

🎮 My Top Gaming Gear 🎮

💻 My Top Software 💻
Рекомендации по теме
Комментарии
Автор

Thank you very much! Simple and clear!
<3

dephi
Автор

Thank you so much! I would really appreciate an addition video showing how to add a new article with tags through a form in a razor component. Thanks!!

michaelrafales
Автор

Hi Alexander! Do you need to specify the many-to-many relationship in your OnModelCreating? Doesnt EF do it by it self, from have you have specified the classes?

marchansen
Автор

I notice this implementation will give you a cyclic reference between the Articles and the Tags. For instance, Article.Tags has Tag.Articles and wise versa. How would go about solving the problem?

sereyvathanakkhorn
Автор

I’ve got a situation similar to this, but I have a user with a list of activities, but each of those activities contains a list of users that have that activity because of the many to many relationship and link table. Can’t figure out for the life of me how to remove that link

thebulletkin
Автор

Thank you very much..Really appreciate it!! Keep going..

kdu
Автор

You didn't show how it's mapped actually, like how do I get ids of an entity and map it

memoryleakerz
Автор

can you provide an insert example as well?

adhikarpatil
Автор

what if we have additional column on the join table? such as "AddedAt" for example

yohanespradono
Автор

Hello, greetings from Bulgaria. Thank you for taking time to make and present those nice tutorials.

Please, do not get me wrong. I am learning EF as of now. Please, tell me, am I correct to think that what you did in the OnModelCreating (i.e. wth the help of fluentAPI) is redundant ? I think EF would create exactly the same result having just the two navigational properties of ICollection type in both Articles and Tags !!??
I am just checking how well my education goes.

mocococo
Автор

Hi! I think it's better to create this ArticleTags table manually instead of give a chance to create by EF. Because when we need to use little more difficult Linq query it starts to be annoying to write difficult Linq queries for simple logic.

justraccoon
Автор

This tells you how to set up many to many relationships but doesn't tell anyone how to "handle" many to many relationships. Please think more carefully when you set the video title.

Jim_Manlove