As the title says, I'm trying to create a EF Core Query filter that hides soft deleted entities. Entities where the field DeletedDate != null
All entities inherit this field from the base class DbEntity
.
If I just do something simple like this, then the base class DbEntity
gets added to the database (which is not what I want).
modelBuilder.Entity<DbEntity>().HasQueryFilter(c => c.DeletedDate == null);
Reading up on this I am supposed to be able to base the query filter of an inherited class. Here is a blog post describing as much: