Entity Framework Extensions Extend your DbContext with high-performance batch and bulk operations



Downloads:
45242249
Customers:
5000+

Improve Entity Framework Performance

Use BulkSaveChanges to execute bulk operations when saving a large number of entities for maximal performance.

Use BatchSaveChanges to combine SQL generated by SaveChanges to reduce database round-trip.


Inserted entities/second

Supported Providers

SQL Server
SQL Azure
MySQL
PostgreSQL
SQLite

Features

Bulk SaveChanges

Use BulkOperations to improve saving performance.

// Easy to use
context.BulkSaveChanges();

// Easy to customize
context.BulkSaveChanges(options => options.BatchSize = 100);
Run

Bulk Operations

Maximize your performance and customize how your entities are saved in the database.

// Easy to use
context.BulkMerge(customers);

// Easy to customize
context.BulkMerge(invoices, options => options.IncludeGraph = true);
Run

Batch SaveChanges

Batch SQL Command generated by SaveChanges in fewer command to reduce database round-trip.

// context.SaveChanges();
context.BatchSaveChanges();
Run

Batch Operations

Execute UPDATE and DELETE statement directly in database with LINQ Query without loading entities in the context.

var dateToDeactivate = DateTime.Now.AddYears(-2);

// UPDATE customers active but didn’t log recently
context.Customers
 .Where(x => x.IsActive && x.LastLogin < dateToDeactivate)
 .UpdateFromQuery(x => new Customer { IsActive = false });

// DELETE customers inactive and without invoice
context.Customers
 .Where(x => !x.IsActive && !x.Invoices.Any())
 .DeleteFromQuery();
Run