Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gjactat opened this issue Sep 30, 2019 · 3 comments
Open

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

gjactat opened this issue Sep 30, 2019 · 3 comments
Assignees

Comments

@gjactat
Copy link

gjactat commented Sep 30, 2019

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 !

@JonathanMagnan
Copy link
Member

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: info@zzzprojects.com 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 JonathanMagnan self-assigned this Sep 30, 2019
@JonathanMagnan
Copy link
Member

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 ;(

@gjactat
Copy link
Author

gjactat commented Oct 1, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants