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
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
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); }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
@system15
Did you manage to do it ?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
@ismcagdas Nope can you let me know any useful changes that may help.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Show your modified code.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
ApplyAbpConceptsForDeletedEntity code is the same as above
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
So you didn't modify anything?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Nope
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
...and you expect something to happen?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
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); }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
What did you expect to happen?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)