Soft Deletes with Entity Framework Core – Wrap Up
Those that follow this blog probably know about my series of posts on soft-deletes with EF Core, which you can find here:
I decided to make the code available at GitHub: https://github.com/rjperes/EFSoftDeletes. Feel free to have a look and see for yourself, I will probably be making some small changes in the future.
I also made available a Nuget package with all this code: https://www.nuget.org/packages/EFSoftDeletes. It is built for .NET 8, and it has a dependency on Entity Framework Core 8, but strictly speaking, it does not need to, so let me know if this is a problem to you. It is generated from the GitHub repo, and it includes:
- A custom convention for adding a shadow property for those entities that implement ISoftDeletable and for creating a global query filter on them
- A custom interceptor for marking deleted entities as soft-deleted instead
- A custom interceptor for marking bulk-deleted entities as soft-deleted
As usual, eager to hear your feedback on this, you can do it through comments here or through by creating issues on GitHub!