Entity Framework Plus Enhance your ORM performance
beyond your wildest dreams.


Downloaded more than
0
times !
// DELETE all users which are inactive for 2 years ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2)) .Delete(); // UPDATE all users which are inactive for 2 years ctx.Users.Where(x => x.LastLoginDate < DateTime.Now.AddYears(-2)) .Update(x => new User() { IsSoftDeleted = 1 });



What's EF Plus?

Entity Framework Plus is the free library powered by Entity Framework Extensions. It extends EF with must-haves missing features.



Which features EF Plus support?

Auditing, Batch Delete, Batch Update, Query Cache, Query Deferred, Query DbSetFilter, Query Filter, Query Future, Query IncludeFilter, Query IncludeOptimized.



Which version of EF is supported?

You can use Entity Framework Plus with EF5, EF6, and EF Core. However, not all features are supported in all versions due to some limitations.



Do Entity Framework Plus support Bulk Insert?

No, but a third-party library does: Entity Framework Extensions. It's a prime library that extend DbContext with all bulk operations.

Learn More


Do you offer consulting services?

Yes, you can contact us for special requests: info@zzzprojects.com



Where can I find examples?

Online example is now available on .NET Fiddle!

Online Examples

Our achievements

2000+ Customers
75+ Countries
4000+ Requests closed
Over 10 000 000+ download
Over 1 000 000+ daily visitors

What we achieved over the last 4 years has grown beyond our hopes. That motivates us to continue to grow and improve all our projects. Every day, we are committed to listening to our clients to help ease the daily dev workload as much as possible.



Auditing

Improve security and know what, when and who did a changes in the context.

  • AutoSave audit values in the database
  • Keep track of SoftDelete entities
  • Filter events you desire
  • Include entity type you desire
  • Format value in your specific format
Auditing Example
var audit = new Audit();
audit.CreatedBy = "ZZZ Projects"; // Optional
ctx.SaveChanges(audit);

// Access to all auditing information
var entries = audit.Entries;
foreach(var entry in entries)
{
 foreach(var property in entry.Properties)
 {
 }
}

Delete without loading entities

Delete rows from LINQ Query in a single database round trip without loading entities in the context

  • Use Async methods to make your application responsive
  • Use batch size to improve performance
  • Use batch delay interval to reduce server load
  • Use Intercept to customize DbCommand
Batch Delete Example
/ DELETE all users inactive for 2 years
var date = DateTime.Now.AddYears(-2);
ctx.Users.Where(x => x.LastLoginDate < date)
    .Delete();

// DELETE using a BatchSize
var date = DateTime.Now.AddYears(-2);
ctx.Users.Where(x => x.LastLoginDate < date)
    .Delete(x => x.BatchSize = 1000);

Update without loading entities

Update rows from LINQ Query in a single database round trip without loading entities in the context

  • Use Async methods to make your application responsive
  • Use Intercept to customize DbCommand
Batch Update Example
// UPDATE all users inactive for 2 years
var date = DateTime.Now.AddYears(-2);
ctx.Users.Where(x => x.LastLoginDate < date)
    .Update(x => new User() { IsSoftDeleted = 1 });

Second Level Cache

Improve application performance and reduce sql server load by using a second level caching.

  • Use Cache Tag to expire cache
  • Use Cache Policy to control caching
Query Cache Example
// The first call perform a database round trip
var countries1 = ctx.Countries.FromCache().ToList();

// Subsequent calls will take the value from the memory instead
var countries2 = ctx.Countries.FromCache().ToList();

Filtering

Improve your context extensibility and create filters to query only what's really available.

  • Create Multi-Tenancy application
  • Exclude soft deleted record
  • Filter record by security access
Query Filter Example
QueryFilterManager.Filter<Post>
    (q => q.Where(x => !x.IsSoftDeleted));

var ctx = new EntitiesContext();

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

Future & FutureValue

Delay queries execution and batch all queries in a single database round trip.

  • Query Future
  • Query Future Value
  • Query Future Value Deferred
  • Include entity type you desire
  • Format value in your specific format
Query Future Example
// 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();

Filter included related entities

Overcome Include method limitations by filtering included related entities.

  • Child entities with IncludeFilter
  • Improve performance with IncludeOptimized
Query IncludeFilter Example
// LOAD orders and the first 10 active related entities.
var list = ctx.Orders.IncludeFilter(x => x.Items
    .Where(y => !y.IsSoftDeleted)
    .OrderBy(y => y.Date)
    .Take(10))
    .ToList();

Consulting

Your company requires some custom solution to extend Entity Framework with more features?

Contact us to learn about our consultation services:
info@zzzprojects.com

You can also find some answers/ help if:

Stack Overflow Issue tracker