NBatch.EntityFrameworkCore
2.0.0
dotnet add package NBatch.EntityFrameworkCore --version 2.0.0
NuGet\Install-Package NBatch.EntityFrameworkCore -Version 2.0.0
<PackageReference Include="NBatch.EntityFrameworkCore" Version="2.0.0" />
<PackageVersion Include="NBatch.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="NBatch.EntityFrameworkCore" />
paket add NBatch.EntityFrameworkCore --version 2.0.0
#r "nuget: NBatch.EntityFrameworkCore, 2.0.0"
#:package NBatch.EntityFrameworkCore@2.0.0
#addin nuget:?package=NBatch.EntityFrameworkCore&version=2.0.0
#tool nuget:?package=NBatch.EntityFrameworkCore&version=2.0.0
NBatch
A lightweight batch processing framework for .NET, inspired by Spring Batch.
📖 Full Documentation — guides, API reference, and examples.
NBatch gives you a declarative, step-based pipeline for ETL jobs, data migrations, and scheduled tasks. Wire up readers, processors, and writers — NBatch handles chunking, error skipping, progress tracking, and restart-from-failure.
Packages
| Package | Description |
|---|---|
NBatch |
Core framework — interfaces, chunking, skip policies, CsvReader, DbReader/DbWriter, DI, hosted service |
NBatch.EntityFrameworkCore |
EF Core job store for restart-from-failure (SQL Server, PostgreSQL, SQLite, MySQL/MariaDB) |
dotnet add package NBatch
dotnet add package NBatch.EntityFrameworkCore # only if you need persistent job tracking
Examples
var job = Job.CreateBuilder("ETL")
.AddStep("extract-transform", step => step
.ReadFrom(new CsvReader<Order>(...))
.WriteTo(new DbWriter<Order>(...))
.WithChunkSize(100))
.AddStep("notify", step => step
.Execute(() => SendEmail()))
.Build();
With SQL-backed job store for restart-from-failure
var job = Job.CreateBuilder("csv-import")
.UseJobStore(connStr, DatabaseProvider.SqlServer) // optional — enables restart-from-failure
.AddStep("import", step => step
.ReadFrom(new CsvReader<Product>("data.csv", mapFn)
.ProcessWith(p => new Product { Name = p.Name.ToUpper(), Price = p.Price })
.WriteTo(new DbWriter<Product>(dbContext))
.WithSkipPolicy(SkipPolicy.For<FormatException>(maxSkips: 5))
.WithChunkSize(100))
.AddStep("notify", step => step
.Execute(() => SendEmail()))
.Build();
await job.RunAsync();
With Dependency Injection & Hosted Service
builder.Services.AddNBatch(nbatch =>
{
nbatch.AddJob("csv-import", (sp, job) => job
.AddStep("import", step => step
.ReadFrom(new CsvReader<Product>("data.csv", mapFn))
.WriteTo(new DbWriter<Product>(sp.GetRequiredService<AppDbContext>()))
.WithChunkSize(100)))
.RunEvery(TimeSpan.FromHours(1));
});
Highlights
- Chunk-oriented processing — read, transform, and write in configurable batches
- Skip policies — skip malformed records instead of aborting the job
- Restart from failure — SQL-backed job store resumes where a crashed job left off
- Tasklet steps — fire-and-forget work (send an email, call an API, run a stored proc)
- Lambda-friendly — processors and writers can be plain lambdas; no extra classes needed
- DI & hosted service —
AddNBatch(),RunOnce(),RunEvery()for background jobs - Multi-target — .NET 8, .NET 9, and .NET 10
- Provider-agnostic — SQL Server, PostgreSQL, SQLite, or MySQL for the job store; any EF Core provider for your data
Documentation
See the full documentation for guides, API reference, and examples:
- Core concepts — jobs, steps, readers, writers, processors
- Readers & writers —
CsvReader,DbReader,DbWriter,FlatFileItemWriter - Skip policies — error handling and skip limits
- Job store — persistent tracking and restart-from-failure
- DI & hosted service —
AddNBatch(),IJobRunner,RunOnce(),RunEvery() - Listeners — job and step lifecycle hooks
- API reference — all public types and methods
- Examples — CSV-to-DB, DB-to-file, multi-step, DI, hosted service
Running locally
# Start the test database (SQL Server via Docker)
cd src && docker compose up -d
# Build & run the demo console app
dotnet build
dotnet run --project NBatch.ConsoleApp
# Run tests
dotnet test
Contributing
- Fork the repo
- Create a feature branch:
git checkout -b my-feature - Commit your changes:
git commit -m "Add my feature" - Push:
git push origin my-feature - Open a pull request
License
See LICENSE for details.
| 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. |
-
net10.0
- Microsoft.EntityFrameworkCore.Sqlite (>= 10.0.3)
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.3)
- NBatch (>= 2.0.0)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.0)
-
net8.0
- Microsoft.EntityFrameworkCore.Sqlite (>= 8.0.24)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.24)
- NBatch (>= 2.0.0)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 8.0.11)
- Pomelo.EntityFrameworkCore.MySql (>= 8.0.3)
-
net9.0
- Microsoft.EntityFrameworkCore.Sqlite (>= 9.0.13)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.13)
- NBatch (>= 2.0.0)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 9.0.4)
- Pomelo.EntityFrameworkCore.MySql (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 35 | 2/24/2026 |
v2.0.0 � EF Core job store split from core NBatch package.