3

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?

Radoslav.Ivanov
  • 413
  • 3
  • 16

1 Answers1

4

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.

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:

  • DeleteFromQuery
  • UpdateFromQuery

In EF+, methods are named:

  • Delete
  • Update

Bulk Operation

Bulk Operation only exists in EFE. They are immediate operations that take a list of entities and saves them with the database.

  • Bulk SaveChanges
  • Bulk Insert
  • Bulk Delete
  • Bulk Update
  • Bulk Merge

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;
});
Jonathan Magnan
  • 10,874
  • 2
  • 38
  • 60
  • So, basically the difference between both versions are that the paid one includes Bulk Operation where the free one just Batch Operation? A features comparison table is missing in the page! – rekiem87 Jul 05 '18 at 21:27
  • hi @Jonathon, can you answer this question? thanks https://stackoverflow.com/questions/63461990/c-sharp-entity-framework-bulk-updatefromquery-in-batches –  Aug 18 '20 at 04:42