GraphDiff icon indicating copy to clipboard operation
GraphDiff copied to clipboard

Deleting join row only in a many to many scenario

Open gjactat opened this issue 6 years ago • 3 comments

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 !

gjactat avatar Sep 30 '19 10:09 gjactat

Hello @gjactat ,

Do you think you could provide a project sample with the problem you would like we solve?

It will help my developer investigate the issue more efficiently.

We now always ask for a project sample even if the issue is easy to reproduce. As a free product, we must find some way to save time to offer an overall better experience for everyone and release fixes faster.

You can send it to: [email protected] if you need to keep the source private

Best Regards,

Jonathan


Performance Libraries context.BulkInsert(list, options => options.BatchSize = 1000); Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation Eval.Execute("x + y", new {x = 1, y = 2}); // return 3 C# Eval FunctionSQL Eval Function

JonathanMagnan avatar Sep 30 '19 15:09 JonathanMagnan

Hello @gjactat ,

Thank you for the report.

My developer looked at it and you are right. We currently do not support the many to many scenario in which you only want the relationship to be deleted.

The major issue is the entity is currently removed in the DbSet and not from the collection itself.

Unfortunately, I believe the development time for this request is a little bit too high to make it works property ;(

JonathanMagnan avatar Oct 01 '19 16:10 JonathanMagnan

Hello, Thank you for taking time to look into this issue. I'll stay tuned, just in case !

gjactat avatar Oct 01 '19 16:10 gjactat