Using Global Query Filters for all entities

For the latest EF Core version (should work for 3.0 also, for earlier versions expression replacement should be handled manually, see ReplacingExpressionVisitor call) you can automate it using some reflection (minimal amount of it), expression trees and IMutableModel.GetEntityTypes in your OnModelCreating method. Something like this should work: // define your filter expression tree Expression<Func<BaseModel, bool>> … Read more