Use BulkSaveChanges to execute bulk operations when saving a large number of entities for maximal performance.
BulkSaveChanges
Use BatchSaveChanges to combine SQL generated by SaveChanges to reduce database round-trip.
BatchSaveChanges
SaveChanges
Bulk SaveChanges
Use BulkOperations to improve saving performance.
// Easy to use context.BulkSaveChanges(); // Easy to customize context.BulkSaveChanges(options => options.BatchSize = 100);
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);
Batch SaveChanges
Batch SQL Command generated by SaveChanges in fewer command to reduce database round-trip.
// context.SaveChanges(); context.BatchSaveChanges();
Batch Operations
Execute UPDATE and DELETE statement directly in database with LINQ Query without loading entities in the context.
UPDATE
DELETE
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();