How to Bulk Insert with Entity Framework?

Updated on     Kisan Patel

Problem:

Fastest Way of Inserting in Entity Framework
How to Perform Bulk Inserts in Entity Framework?
How to Bulk Insert with Entity Framework?
How to Perform Batch Operations Using Entity Framework?

Solution:

For bulk insert, you need to use EntityFramework.BulkInsert extension for EntityFramework.

Example:

context.BulkInsert(booksList);
context.SaveChanges();

You can also use EntityFramework.Utilities that provides batch operations for inserting, updating, and deleting many entities.

EFBatchOperation.For(context, context.Books).InsertAll(booksList);

Entity Framework

Leave a Reply