zzzprojects / GraphDiff

GraphDiff is a library that allows the automatic update of a detached graph using Entity Framework code first.
https://entityframework-graphdiff.net/overview
MIT License
333 stars 102 forks source link

Concurrency check for Associated* #151

Open jods4 opened 8 years ago

jods4 commented 8 years ago

When mapping Associated* relationships, GraphDiff does not enforce optimistic concurrency.

I think that for many-to-many relationships this is a good default behavior (the other entity is not really modified). I am not sure if the use-cases where you'd need that should be handled with an option or in user code.

For one-to-many on the other hand, checking concurrency should be the default behavior. After all GraphDiff loads the foreign entity from DB and modifies it directly (its concurrency stamp will bump, even if it's not checked). Consider that two users trying to establish the relationship concurrently would be in a last-write-wins situation (unlike many-to-many).

Adding a concurrency check and making it the default would be a breaking change, so maybe that's not possible. But at least it should be possible to enable concurrency checks.