PgBulk 2.0.1
dotnet add package PgBulk --version 2.0.1
NuGet\Install-Package PgBulk -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PgBulk" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PgBulk" Version="2.0.1" />
<PackageReference Include="PgBulk" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PgBulk --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PgBulk, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PgBulk@2.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PgBulk&version=2.0.1
#tool nuget:?package=PgBulk&version=2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PgBulk
High-performance bulk operations for PostgreSQL using Npgsql binary import (COPY ... FROM STDIN BINARY).
Features
- Bulk Insert — fast binary import of large datasets
- Bulk Merge (Upsert) — insert or update using primary key or custom key columns
- Bulk Sync — replace table contents (delete + insert) with optional
WHEREclause - EF Core integration — extension methods on
DbContextwith automatic table/column mapping - Manual mapping — use without EF Core by defining table mappings explicitly
- CancellationToken support throughout all async operations
- Configurable timeout —
CommandTimeoutproperty (default:0= infinite, appropriate for bulk workloads) - Multi-target:
net8.0,net9.0,net10.0
Installation
dotnet add package PgBulk.EFCore
Or for usage without EF Core:
dotnet add package PgBulk
Quick Start (EF Core)
using PgBulk.EFCore;
// Bulk insert
await dbContext.BulkInsertAsync(entities);
// Bulk upsert (merge) — matches on primary key
await dbContext.BulkMergeAsync(entities);
// Bulk sync — deletes rows not in the collection, then inserts all
await dbContext.BulkSyncAsync(entities);
// With options
await dbContext.BulkInsertAsync(entities,
timeoutOverride: 120,
onConflictIgnore: true,
cancellationToken: ct);
Quick Start (Manual Mapping)
var provider = new ManualTableInformationProvider()
.AddTableMapping<MyEntity>("my_table", c => c.Automap());
var bulk = new ManualBulkOperator(connectionString, provider);
await bulk.InsertAsync(entities, onConflictIgnore: false);
Custom Merge Keys
By default, merge uses the primary key. To merge on different columns:
var keyProvider = new EntityManualTableKeyProvider<MyEntity>();
await keyProvider.AddKeyColumn(e => e.ExternalId, dbContext);
await dbContext.BulkMergeAsync(entities, tableKeyProvider: keyProvider);
Timeout Configuration
The default CommandTimeout is 0 (infinite), which is appropriate for bulk operations on large datasets. Override per-call or per-operator:
// Per-call via extension method
await dbContext.BulkInsertAsync(entities, timeoutOverride: 300);
// Per-operator instance
var op = dbContext.GetBulkOperator(timeoutOverride: 300);
// or
op.CommandTimeout = 300;
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Nanoid (>= 3.1.0)
- Npgsql (>= 10.0.0 && < 12.0.0)
- PgBulk.Abstractions (>= 2.0.1)
-
net8.0
- Nanoid (>= 3.1.0)
- Npgsql (>= 8.0.0 && < 10.0.0)
- PgBulk.Abstractions (>= 2.0.1)
-
net9.0
- Nanoid (>= 3.1.0)
- Npgsql (>= 9.0.0 && < 11.0.0)
- PgBulk.Abstractions (>= 2.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PgBulk:
| Package | Downloads |
|---|---|
|
PgBulk.EFCore
High-performance bulk operations (insert, merge, sync) for PostgreSQL using Npgsql binary import. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.1 | 82 | 2/20/2026 |
| 2.0.0 | 149 | 2/19/2026 |
| 1.2.2 | 1,983 | 12/14/2023 |
| 1.2.1 | 240 | 12/14/2023 |
| 1.2.0 | 277 | 12/14/2023 |
| 1.1.12 | 284 | 11/6/2023 |
| 1.1.11 | 2,601 | 11/6/2023 |
| 1.1.10 | 380 | 10/9/2023 |
| 1.1.9 | 260 | 10/6/2023 |
| 1.1.8 | 271 | 10/4/2023 |
| 1.1.7 | 470 | 10/2/2023 |
| 1.1.6 | 314 | 9/27/2023 |
| 1.1.5 | 256 | 9/25/2023 |
| 1.1.4 | 283 | 9/22/2023 |
| 1.1.3 | 259 | 9/21/2023 |
| 1.1.2 | 255 | 9/20/2023 |
| 1.1.1 | 241 | 9/20/2023 |
| 1.1.0 | 254 | 9/20/2023 |
| 1.0.9 | 1,833 | 7/1/2022 |
| 1.0.8 | 741 | 6/30/2022 |
Loading failed