GithubHelp home page GithubHelp logo

andreisabau / efbulkinsert Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 7.0 96 KB

Extension method over the Entity Framework DbContext for bulk insertion of entities.

Home Page: https://www.nuget.org/packages/EFBulkInsert/

License: MIT License

C# 100.00%
entity-framework bulk insert bulkinsert

efbulkinsert's Introduction

CI Nuget Nuget

EFBulkInsert

Provides an extension method over the Entity Framework DbContext for bulk insertion of entities.

BulkInsert<T>(IEnumerable<T> entities, int batchSize = 5000)

Allows fast insertion of entities in bulk with retrieval of the generated identity column.

Installation:

Package Manger
Install-Package EFBulkInsert -Version 0.4.0
.NET CLI
dotnet add package EFBulkInsert --version 0.4.0
PackageReference
<PackageReference Include="EFBulkInsert" Version="0.4.0" />

Usage:

dbContext.BulkInsert(entites);

dbContext.BulkInsert(entities, 10000); // bulk insert with batch size of 10000

Performance improvements

# of entities BulkInsert EF SaveChanges
1000 127 ms 493 ms
5000 153 ms 2573 ms
10000 191 ms 4214 ms
50000 485 ms 22542 ms
100000 871 ms 41374 ms
500000 3916 ms N/A
1000000 7769 ms N/A

Tests made with: SQL Server 2016, EntityFramework 6.1.3 and EFBulkExtensions 0.1.0.

Version history

v0.4.0 (2020-03-09)
  • Added: Support for Entity Framework Core 3.1.0
v0.3.0 (2018-03-27)
  • Added: Support for schemas
  • Fixed: Inserting into tables without identity columns
  • Fixed: Retrieving the table name from EF metadata
v0.2.0 (2017-05-17)
  • Fixed: Support for transactions
v0.1.0 (2017-01-26)
  • Initial release

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.