Entity Framework Bulk Insert Library

Introduction

Entity Framework Bulk Insert library allow you to improve EF performance by inserting multiples entities with bulk operations.

Why using Bulk Insert with Entity Framework?

For HUGE performance gains.

Entity Framework makes one database round-trip for each entity to insert

So if you want to add 10,000 entities, 10,000 database round trip will be required which is INSANELY slow.

Operations 1,000 Entities 2,000 Entities 5,000 Entities
BulkInsert 6 ms 10 ms 15 ms
SaveChanges 1,000 ms 2,000 ms 5,000 ms


Google – Related Searches


Stack Overflow – Related Questions


Example

// using Z.EntityFramework.Extensions; // Don't forget to include this.
// Easy to use
context.BulkInsert(list);
// Easy to customize
context.BulkInsert(list, bulk => bulk.BatchSize = 100);

Supported Library

Library Type EF Version Support Doc Features
Z.EntityFramework.Extensions PRO EF6 < 1 Day Yes
  • Bulk SaveChanges
  • Bulk Insert
  • Bulk Update
  • Bulk Delete
  • Bulk Merge

Unsuported Library

Use them at your risk!

Library Type EF Version Support Doc Features
EFUtilities FREE EF5
EF6
No No
  • Bulk Insert
  • Batch Delete
  • Batch Update
  • Include Optimized
EntityFramework.BulkInsert FREE EF5
EF6
No Yes
  • Bulk Insert