Filter

Introduction

Filter allows you to filter data from the DbContext with predefined filters.

Why Filters?

Common Scenarios:

  • Default Ordering
  • Logical Data Partitioning
  • Multi-Tenancy
  • Soft Deleted
  • Security Access

Example

// using Z.EntityFramework.Plus; // Don't forget to include this.
var ctx = new EntitiesContext();

ctx.Filter<Post>(q => q.Where(x => !x.IsSoftDeleted));

// SELECT * FROM Post WHERE IsSoftDeleted = false
var list = ctx.Posts.ToList();

Supported Libraries

Library Type EF Version Support Doc Features
Z.EntityFramework.Plus FREE EF5
EF6
EF Core
< 1 Day Yes Audit
Batch Delete
Batch Update
Cache
Deferred Query
Filter
Future
Include Filter
Include Optimized
EntityFramework.DynamicFilters FREE EF6 < 2 Days Yes Filter

Unsuported Libraries

Use this library at your risk!

Library Type EF Version Support Doc Features
EntityFramework.Filters FREE EF6 No Yes Filter