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