Npgsql.Bulk 0.7.4

Extension for Entity Framework Npgsql for Bulk Copy

Install-Package Npgsql.Bulk -Version 0.7.4
dotnet add package Npgsql.Bulk --version 0.7.4
<PackageReference Include="Npgsql.Bulk" Version="0.7.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Npgsql.Bulk --version 0.7.4
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 1.5 and 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 1.5 and 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

Implemented partial update in Update method

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.7.4 1,028 7/20/2019
0.7.3 53 7/20/2019
0.7.2 5,481 6/25/2019
0.7.1 1,487 6/14/2019
0.7.0 1,143 5/19/2019
0.6.9 4,077 4/25/2019
0.6.8 2,026 4/3/2019
0.6.7 92 4/2/2019
0.6.6 237 3/22/2019
0.6.5 120 3/20/2019
0.6.4 326 3/2/2019
0.6.3 204 2/12/2019
0.6.2 1,925 11/1/2018
0.6.1 3,254 9/14/2018
0.6.0 181 9/13/2018
0.5.21 679 9/13/2018
0.5.20 431 8/23/2018
0.5.19 164 8/22/2018
0.5.18 165 8/21/2018
0.5.17 245 7/23/2018
0.5.16 484 5/23/2018
0.5.15 288 5/16/2018
0.5.14 261 5/1/2018
0.5.13 429 2/23/2018
0.5.12 346 1/10/2018
0.5.11 310 1/9/2018
0.5.10 310 12/26/2017
0.5.9 325 12/25/2017
0.5.8 420 12/11/2017
0.5.7 386 12/10/2017
0.5.6 297 11/16/2017
0.5.5 295 11/1/2017
0.5.4 279 10/25/2017
0.5.2 294 10/17/2017