Many to Many Relationship Entity Framework

69 Views Asked by At

Well, I have tried to do a Many-to-Many relationship using Entity framework, where the Join table has more than just two ID, it will have two other columns Active and DateUpdate. So here is the designer.

Tables Design

When I did the context importing from an existing database, it look to work well. But I got a big question, is it right have the direction going from Group[0].GroupUser[0].User and going back in the same case? And in that way creating a lot of redundancy has showed in the picture below? Or is it something wrong?

Redundancy

1

There are 1 best solutions below

0
On

It is not redundancy. Group[0].GroupUser[0].User is a reference to User and User has a navigation property to the GroupUser. Therefore, when you see User and then navigate to GroupUser of that user, the GroupUser will have a reference to User. If you keep expanding, it will keep showing you the same User and GroupUser.