Entity Framework Future Library

Introduction

Entity Framework Future library allow you to batches multiple LINQ queries to be executed in one SQL Command to perform only a single database round trip.

Why using Future with Entity Framework?

Common scenario:

  • Reduce the number of database round trip


Google – Related Searches


Stack Overflow – Related Questions

  • TBD


Example

// using Z.EntityFramework.Plus; // Don't forget to include this.
var ctx = new EntitiesContext();
// CREATE a pending list of future queries
var futureCountries = db.Countries.Where(x => x.IsActive).Future();
var futureStates = db.States.Where(x => x.IsActive).Future();
// TRIGGER all pending queries in one database round trip
// SELECT * FROM Country WHERE IsActive = true;
// SELECT * FROM State WHERE IsActive = true
var countries = futureCountries.ToList();
// futureStates is already resolved and contains the result
var states = futureStates.ToList();

Supported Library

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

Unsuported Library

Use them at your risk!

Library Type EF Version Support Doc Features
EntityFramework.Extended FREE EF5
EF6
No Yes
  • Audit
  • Batch Delete
  • Batch Update
  • Cache
  • Future