using System.Data.Entity;
using System.Collections.Generic;
using Z.EntityFramework.Plus;
public static void Main()
using (var context = new EntityContext())
context.Filter<Customer>(q => q.Where(x => x.IsActive));
var list = context.Customers.ToList();
FiddleHelper.WriteTable("After Filtering", list);
FiddleHelper.WriteTable("AsNoFilter", context.Customers.AsNoFilter().ToList());
public static void GenerateData()
using (var context = new EntityContext())
context.Customers.Add(new Customer() { Name ="Customer_A", IsActive = false });
context.Customers.Add(new Customer() { Name ="Customer_B", IsActive = true });
context.Customers.Add(new Customer() { Name ="Customer_C", IsActive = false });
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
public DbSet<Customer> Customers { get; set; }
public int CustomerID { get; set; }
public string Name { get; set; }
public Boolean IsActive { get; set; }