I was looking into Entity Framework extensions for bulk operations and I found from the same developers EF Plus. Now EFE has bulk operations which are payed and EF PLus has Batch operations, which claim to perform bulk update and delete only, but are called batch operations. So what is the difference between the EFE's bulk operations and EF plus batch operations?
Disclaimer: I'm the owner of the project Entity Framework Extensions
Disclaimer: I'm the owner of the project Entity Framework Plus
There is a huge difference between methods that are called Bulk Operation
and Batch Operation
.
Bach operation performs an operation in the database without loading data in the context. In short, everything is done on the database side.
Both libraries support it and it will eventually be supported in one library (for free no matter the library decision)
In EFE, methods are named:
In EF+, methods are named:
Bulk Operation only exists in EFE. They are immediate operations that take a list of entities and saves them with the database.
Example
// Easy to use
context.BulkSaveChanges();
// Easy to customize
context.BulkSaveChanges(bulk => bulk.BatchSize = 100);
// Perform Bulk Operations
context.BulkDelete(customers);
context.BulkInsert(customers);
context.BulkUpdate(customers);
// Customize Bulk Operations
context.BulkInsert(customers, options => {
options => options.IncludeGraph = true;
});
context.BulkMerge(customers, options => {
options.ColumnPrimaryKeyExpression =
customer => customer.Code;
});