Entity Framework Plus Query Filter - Filter By Instance
Instance filter applies filters to the current context only. The filtering logic is added once the context is created.
// using Z.EntityFramework.Plus; // Don't forget to include this. var ctx = new EntitiesContext(); ctx.Filter<Customer>(q => q.Where(x => x.IsActive)); // SELECT * FROM Customer WHERE IsActive = true var list = ctx.Customers.ToList();
Use entities context constructor to make some filter "global" to all context.