© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
101 replies
Dusty

✅ Soft Deletions with EF Core

Hey,
instead of deleting the entry from the DB directly I am setting a
IsDeleted
IsDeleted
property to true.
Generic saving etc. works already.

Now to my problem:
I don't want to call
.Where(x => !x.IsDeleted)
.Where(x => !x.IsDeleted)
every time I query an entity as it's very error prone.

Is there any good design pattern you'd recommend to add this to (almost) every call?

What I've tried so far are global query filters.
The issue with that is that several entities depend on the entity that has this global query filter. If I remove the global query filter it works fine but then I do remove my tenant logic.
So global query filters are not an option.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

EF Core
C#CC# / help
2y ago
✅ EF Core migrations with Docker
C#CC# / help
11mo ago
Calculated Properties with EF Core
C#CC# / help
2y ago
✅ System.NotSupportedException with EF Core
C#CC# / help
3y ago