Hi there does anyone know how to handle delete concurrecy if an entity gets deleted having two tabs opened with the same entites and deleting the entity in the first tab and trying to make changes to the entity in the second tab and saving that?
12 Answer(s)
-
0
Hi @system15,
You can refer to EF Core's documentation https://docs.microsoft.com/en-us/ef/core/saving/concurrency
-
0
@aaron yes it's similar I'm trying to apply the solution of:
protected override void ApplyAbpConceptsForModifiedEntity(EntityEntry entry, long? userId, EntityChangeReport changeReport) { if (entry.Entity is MyRowVersionEntity) { entry.OriginalValues["RowVersion"] = entry.CurrentValues["RowVersion"]; } base.ApplyAbpConceptsForModifiedEntity(entry, userId, changeReport); }
To
protected override void ApplyAbpConceptsForDeletedEntity(EntityEntry entry, long? userId, EntityChangeReport changeReport) { base.ApplyAbpConceptsForDeletedEntity(entry, userId, changeReport); }
-
0
@system15
Did you manage to do it ?
-
0
@ismcagdas Nope can you let me know any useful changes that may help.
-
0
Show your modified code.
-
0
ApplyAbpConceptsForDeletedEntity code is the same as above
-
0
So you didn't modify anything?
-
0
Nope
-
0
...and you expect something to happen?
-
0
Well yes the following code works if two users are editing the same entity:
protected override void ApplyAbpConceptsForModifiedEntity(EntityEntry entry, long? userId, EntityChangeReport changeReport) { if (entry.Entity is MyRowVersionEntity) { entry.OriginalValues["RowVersion"] = entry.CurrentValues["RowVersion"]; } base.ApplyAbpConceptsForModifiedEntity(entry, userId, changeReport); }
-
0
What did you expect to happen?