Npgsql.Bulk 0.8.2

Extension for Entity Framework Npgsql for Bulk Copy

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

Tiny bugs fixes

NuGet packages (1)

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

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

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.8.2 4,849 9/3/2020
0.8.1.1 27,668 4/18/2020
0.8.1 119 4/18/2020
0.8.0 7,968 1/18/2020
0.8.0-beta 144 1/5/2020
0.7.7.1 22,163 11/23/2019
0.7.7 5,999 11/14/2019
0.7.6.1 4,853 10/11/2019
0.7.6 1,036 10/6/2019
0.7.5 19,177 9/29/2019
0.7.4 3,186 7/20/2019
0.7.3 148 7/20/2019
0.7.2 6,473 6/25/2019
0.7.1 3,086 6/14/2019
0.7.0 2,709 5/19/2019
0.6.9 6,001 4/25/2019
0.6.8 3,478 4/3/2019
0.6.7 194 4/2/2019
0.6.6 564 3/22/2019
0.6.5 209 3/20/2019
0.6.4 1,026 3/2/2019
0.6.3 310 2/12/2019
0.6.2 3,120 11/1/2018
0.6.1 4,670 9/14/2018
0.6.0 312 9/13/2018
0.5.21 814 9/13/2018
0.5.20 557 8/23/2018
0.5.19 286 8/22/2018
0.5.18 280 8/21/2018
0.5.17 374 7/23/2018
0.5.16 618 5/23/2018
0.5.15 444 5/16/2018
0.5.14 395 5/1/2018
0.5.13 588 2/23/2018
0.5.12 476 1/10/2018
0.5.11 464 1/9/2018
0.5.10 464 12/26/2017
0.5.9 456 12/25/2017
0.5.8 581 12/11/2017
0.5.7 538 12/10/2017
0.5.6 429 11/16/2017
0.5.5 431 11/1/2017
0.5.4 415 10/25/2017
0.5.2 433 10/17/2017