Npgsql.Bulk 0.9.0

Extension for Entity Framework Npgsql for Bulk Copy

Install-Package Npgsql.Bulk -Version 0.9.0
dotnet add package Npgsql.Bulk --version 0.9.0
<PackageReference Include="Npgsql.Bulk" Version="0.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Npgsql.Bulk --version 0.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Npgsql.Bulk

Helper for performing COPY (bulk insert and update) operation easily, using Entity Framework + Npgsql.

.Net 4.5, Standard 2.0 are supported.

var uploader = new NpgsqlBulkUploader(context);
var data = GetALotOfData();

// To create a lot of objects
uploader.Insert(data);

// To update a lot of objects
uploader.Update(data);

For .Net 4.5 BulkSelect operation is implemented which emulates join in-memory table to DB table. Here is the example:

// We need DbContext first
var context = GetContext();                 

// Obtained a collection of 50k transactions
var transactions = GetListOfTransction();   

// Need to get prices from DB for all transactions, do it with 1 SQL call
var prices = context.Prices.BulkSelect(
    x => new { x.Ticker, x.TradedOn },                      // need to specify key for JOIN
    transactions.Select(x => new { x.Ticker, x.TradedOn })  // obtain key data from local objects
);

// Done, prices variable now contains List<Price> which matches the JOIN DB table to in-memory collection

Npgsql.Bulk

Helper for performing COPY (bulk insert and update) operation easily, using Entity Framework + Npgsql.

.Net 4.5, Standard 2.0 are supported.

var uploader = new NpgsqlBulkUploader(context);
var data = GetALotOfData();

// To create a lot of objects
uploader.Insert(data);

// To update a lot of objects
uploader.Update(data);

For .Net 4.5 BulkSelect operation is implemented which emulates join in-memory table to DB table. Here is the example:

// We need DbContext first
var context = GetContext();                 

// Obtained a collection of 50k transactions
var transactions = GetListOfTransction();   

// Need to get prices from DB for all transactions, do it with 1 SQL call
var prices = context.Prices.BulkSelect(
    x => new { x.Ticker, x.TradedOn },                      // need to specify key for JOIN
    transactions.Select(x => new { x.Ticker, x.TradedOn })  // obtain key data from local objects
);

// Done, prices variable now contains List<Price> which matches the JOIN DB table to in-memory collection

Release Notes

.Net 5 support

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Npgsql.Bulk:

Package Downloads
Hikari
C#数据库连接池,管理多数据库连接 郑重说明:本库定位于数据库连接池,源码GitHub开源公开
BlueBitSoft.BlueUtility
Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.9.0 3,415 11/19/2020
0.8.4 2,187 11/6/2020
0.8.3.1 274 11/2/2020
0.8.3 223 10/30/2020
0.8.2 12,074 9/3/2020
0.8.1.1 39,858 4/18/2020
0.8.1 158 4/18/2020
0.8.0 10,308 1/18/2020
0.8.0-beta 183 1/5/2020
0.7.7.1 27,673 11/23/2019
0.7.7 7,298 11/14/2019
0.7.6.1 5,041 10/11/2019
0.7.6 1,093 10/6/2019
0.7.5 19,917 9/29/2019
0.7.4 3,273 7/20/2019
0.7.3 182 7/20/2019
0.7.2 6,504 6/25/2019
0.7.1 3,366 6/14/2019
0.7.0 2,977 5/19/2019
0.6.9 6,030 4/25/2019
0.6.8 3,652 4/3/2019
0.6.7 218 4/2/2019
0.6.6 718 3/22/2019
0.6.5 237 3/20/2019
0.6.4 1,052 3/2/2019
0.6.3 334 2/12/2019
0.6.2 3,498 11/1/2018
0.6.1 4,923 9/14/2018
0.6.0 335 9/13/2018
0.5.21 853 9/13/2018
0.5.20 583 8/23/2018
0.5.19 315 8/22/2018
0.5.18 311 8/21/2018
0.5.17 410 7/23/2018
0.5.16 649 5/23/2018
0.5.15 475 5/16/2018
0.5.14 424 5/1/2018
0.5.13 625 2/23/2018
0.5.12 502 1/10/2018
0.5.11 486 1/9/2018
0.5.10 514 12/26/2017
0.5.9 482 12/25/2017
0.5.8 629 12/11/2017
0.5.7 564 12/10/2017
0.5.6 471 11/16/2017
0.5.5 462 11/1/2017
0.5.4 443 10/25/2017
0.5.2 471 10/17/2017