Skip to content

Deleting join row only in a many to many scenario #180

@gjactat

Description

@gjactat

Hello,
Maybe someone can help me with this one...

Description

I'm testing GraphDiff to circumvent the lack of support for detached graph updates in Entity Framework.

I have 3 tables : Users, Groups and UsersGroups which is a simple join table with two columns (UserId, GroupId). These two columns are the composite key. This way, users can belong to zero or more groups.

I have a Group1 entity with 3 users (UserA, UserB and UserC). If I serialize this object in JSON and try to UpdateGraph it back with only two users left (say UserA and UserB), then The UsersGroups join row <UserC, Group1> is deleted from the Database (which is fine).... But UserC is deleted as well (which is something I don't want here. I'd like to remove him from Group1 but keep him safe).

Is there any configuration trick that could handle this scenario ? Maybe something to change in the DB schema ?

Further technical details

  • EF version: v6.2.0
  • GraphDiff version: v3.1.0
  • Database Provider: System.Data.SqlClient

Thanks for your attention !

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions