Swevo.EFCore.BulkOperations
1.0.1
Prefix Reserved
dotnet add package Swevo.EFCore.BulkOperations --version 1.0.1
NuGet\Install-Package Swevo.EFCore.BulkOperations -Version 1.0.1
<PackageReference Include="Swevo.EFCore.BulkOperations" Version="1.0.1" />
<PackageVersion Include="Swevo.EFCore.BulkOperations" Version="1.0.1" />
<PackageReference Include="Swevo.EFCore.BulkOperations" />
paket add Swevo.EFCore.BulkOperations --version 1.0.1
#r "nuget: Swevo.EFCore.BulkOperations, 1.0.1"
#:package Swevo.EFCore.BulkOperations@1.0.1
#addin nuget:?package=Swevo.EFCore.BulkOperations&version=1.0.1
#tool nuget:?package=Swevo.EFCore.BulkOperations&version=1.0.1
EFCore.BulkOperations
Free, MIT-licensed bulk insert/update/delete for EF Core. No commercial license required — ever.
Why EFCore.BulkOperations?
SaveChangesAsync sends one round trip per row, which falls over once you need to insert
thousands of entities at a time. Commercial libraries like Z.EntityFramework.Extensions solve
this well but require a paid license per developer/server. EFCore.BulkOperations gives you the
same core capability — high-throughput bulk insert, plus update/delete — fully free and open
source under MIT.
using EFCore.BulkOperations;
await dbContext.BulkInsertAsync(orders);
await dbContext.Orders
.Where(o => o.Status == OrderStatus.Pending)
.BulkUpdateAsync(setters => setters.SetProperty(o => o.Status, OrderStatus.Cancelled));
await dbContext.Orders
.Where(o => o.CreatedAt < cutoff)
.BulkDeleteAsync();
Install
dotnet add package Swevo.EFCore.BulkOperations
How it works
BulkInsertAsync— on SQL Server, streams entities straight intoSqlBulkCopy(no intermediateDataTable, no per-rowSaveChangesround trip). On every other provider (SQLite, InMemory, Npgsql, etc.) it automatically falls back to chunkedAddRange+SaveChangesAsyncbatches withChangeTracker.Clear()between batches, so the same call works everywhere — just faster on SQL Server.BulkUpdateAsync/BulkDeleteAsync— thin, discoverable wrappers around EF Core's nativeExecuteUpdateAsync/ExecuteDeleteAsync, rounding out the bulk-operations API surface under one consistent name.- Database-generated columns (identity primary keys, computed columns) are automatically
excluded from the insert payload — set
BulkInsertOptions.ExcludeDatabaseGeneratedColumns = falseto override.
await dbContext.BulkInsertAsync(orders, new BulkInsertOptions
{
BatchSize = 5000,
TimeoutSeconds = 60,
});
Roadmap
BulkInsertOrUpdateAsync(upsert/merge) is planned for a future 1.1 release. It's deliberately out of scope for 1.0 to ship a well-tested, focused insert/update/delete core first.
Design goals
- MIT licensed, forever. No commercial tier, no per-seat fees.
- Same API everywhere. SQL Server gets
SqlBulkCopyperformance; every other provider gets a correct, tested fallback — you don't need#ifbranches in your app code. - No hard SqlClient dependency at runtime for non-SQL-Server apps — the SQL Server path is
only exercised when
DbContext.Database.ProviderNamereports the SQL Server provider.
💼 Need .NET consulting?
I'm the author of EFCore.BulkOperations and a suite of compile-time source generators (AutoWire, AutoMap.Generator) and 28+ Polly v8 resilience packages. I'm available for consulting on Polly v8 resilience, Azure cloud architecture, and clean .NET design.
→ solidqualitysolutions.com · LinkedIn
Also by the same author
🌐 Full suite overview: swevo.github.io
| Package | Description |
|---|---|
| FluentPdf | Free, MIT-licensed fluent PDF generation — alternative to QuestPDF's commercial license. |
| AutoBus | Free, MIT-licensed message bus — alternative to MassTransit's commercial license. |
| AutoArchitecture | Free, MIT-licensed compile-time architecture rule enforcement — alternative to NDepend. |
| AutoAssert | Free, MIT-licensed fluent assertions — alternative to FluentAssertions' commercial license. |
| AutoWire | Compile-time DI auto-registration — [Scoped]/[Singleton]/[Transient] generates IServiceCollection registration code. |
| AutoMap.Generator | Compile-time object mapping — [Map(typeof(Dto))] generates ToDto() extension methods. |
| EFCore.Outbox | Transactional outbox pattern for EF Core. |
| AutoDispatch.Generator | Compile-time CQRS dispatcher — free alternative to MediatR's commercial license. |
| PollyAnalyzers | Free Roslyn analyzers for async/resilience anti-patterns — blocking calls, async void, fire-and-forget tasks, swallowed exceptions. |
| PollyAction | Free retry/backoff GitHub Action — wrap any CI step with exponential-backoff retries. |
License
MIT © Justin Bannister
| 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 was computed. 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 was computed. 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. |
-
net8.0
- Microsoft.Data.SqlClient (>= 5.2.3)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.28)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.0.1: Add missing package icon. 1.0.0: Initial release. BulkInsertAsync (SqlBulkCopy for SQL Server, chunked fallback for other providers), BulkUpdateAsync, BulkDeleteAsync.