-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add concurrency check for soft delete operations #24469
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds concurrency checking for soft delete operations to ensure that entities are not soft deleted if they have been modified in the database since they were loaded. The implementation preserves the entity's ConcurrencyStamp during the soft delete process in Entity Framework Core and adds equivalent validation to the MemoryDb implementation for test consistency.
Key Changes
- Modified Entity Framework Core's soft delete logic to preserve and validate ConcurrencyStamp values
- Added concurrency stamp validation to MemoryDb's Update method
- Added test coverage to verify concurrency checking behavior during soft delete operations
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
SoftDelete_Tests.cs |
Added test case to verify that soft delete operations properly check concurrency stamps and throw exceptions when the stamp doesn't match |
MemoryDatabaseCollection.cs |
Added concurrency stamp validation in the Update method to check if the entity has been modified since it was loaded |
AbpDbContext.cs |
Modified ApplyAbpConceptsForDeletedEntity to preserve the entity's ConcurrencyStamp before reloading, enabling Entity Framework Core's optimistic concurrency check during soft deletes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs
Outdated
Show resolved
Hide resolved
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs
Show resolved
Hide resolved
framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs
Show resolved
Hide resolved
…elete_Tests.cs Co-authored-by: Copilot <[email protected]>
…elete_Tests.cs Co-authored-by: Copilot <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## rel-10.0 #24469 +/- ##
============================================
- Coverage 51.05% 51.03% -0.03%
============================================
Files 3284 3287 +3
Lines 106932 107304 +372
Branches 8218 8247 +29
============================================
+ Hits 54595 54762 +167
- Misses 50656 50855 +199
- Partials 1681 1687 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
https://abp.io/support/questions/10252/Entity-Framework-Concurrency-Check-with-Soft-Delete-in-ABP--Deletion-Use-Case#answer-3a1e610b-c752-e3eb-45f0-371895276958