Entity Framework Core Plus Query Filter - Filter By Query
Query filter applies filters to specific queries only. The filtering logic is added globally or by instance but in a disabled state and then it is enabled by these specific queries.
// using Z.EntityFramework.Plus; // Don't forget to include this. var ctx = new EntitiesContext(); // CREATE a disabled filter ctx.Filter<Customer>(MyEnum.EnumValue, q => q.Where(x => x.IsActive), false); // SELECT * FROM Customer WHERE IsActive = true var list = ctx.Customers.Filter(MyEnum.EnumValue).ToList();