EF.Toolkit.Audit.Bulk 10.0.0-alpha.7

This is a prerelease version of EF.Toolkit.Audit.Bulk.
dotnet add package EF.Toolkit.Audit.Bulk --version 10.0.0-alpha.7
                    
NuGet\Install-Package EF.Toolkit.Audit.Bulk -Version 10.0.0-alpha.7
                    
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="EF.Toolkit.Audit.Bulk" Version="10.0.0-alpha.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EF.Toolkit.Audit.Bulk" Version="10.0.0-alpha.7" />
                    
Directory.Packages.props
<PackageReference Include="EF.Toolkit.Audit.Bulk" />
                    
Project file
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 EF.Toolkit.Audit.Bulk --version 10.0.0-alpha.7
                    
#r "nuget: EF.Toolkit.Audit.Bulk, 10.0.0-alpha.7"
                    
#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 EF.Toolkit.Audit.Bulk@10.0.0-alpha.7
                    
#: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=EF.Toolkit.Audit.Bulk&version=10.0.0-alpha.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=EF.Toolkit.Audit.Bulk&version=10.0.0-alpha.7&prerelease
                    
Install as a Cake Tool

EF.Toolkit.Audit.Bulk

The bridge between EF.Toolkit.Audit and EF.Toolkit.Bulk. Install it only if you use both.

It closes one gap: the explicit bulk API bypasses the change tracker — that is where its advantage comes from — so no SaveChanges interceptor ever sees it, and an audit trail that relies on one silently misses every BulkInsertAsync in the codebase.

Install

dotnet add package EF.Toolkit.Audit.Bulk

You will already have a provider package for each half — this one is provider-neutral.

Setup

One extra line, after both halves are registered:

services.AddDbContext<AppDb>(o => o
    .UseNpgsql(connectionString)
    .UseBulkOperations()
    .UseAuditing(a => a.Schema("audit"))
    .UseBulkAuditing());          // this package

It throws at startup if either half is missing, so it cannot be forgotten quietly.

What changes

  • BulkInsert / Update / Delete / Merge / Synchronize produce audit entries, inside the operation's own transaction and after generated keys have landed.
  • Those entries are written through a bulk copy once there are enough of them, because auditing a hundred-thousand-row operation produces a hundred thousand entries.

Transparent mode needs none of this. UseBulkOperations() replaces a service below SaveChanges, so an accelerated save is already audited by UseAuditing() alone.

Before-images

A detached object carries no earlier state, so an update or delete reads the rows it is about to change first — one indexed read joined to the staging table the operation already built, inside the same transaction, taking the row locks the write is about to take anyway.

That is what lets a bulk-updated row's entry carry the same old-to-new diff a SaveChanges-updated row's does. It also settles a merge's insert-versus-update split per row, and captures the rows a synchronise's delete arm is about to remove — which correspond to nothing the caller passed in and would otherwise vanish without trace.

Opt out per call, knowing what it costs:

await context.BulkUpdateAsync(orders, o => o.WithoutBeforeImages());   // new values only
await context.BulkDeleteAsync(orders, o => o.WithoutObservers());      // no entries at all

A merge or synchronise refuses WithoutBeforeImages(), because without them there is no way to say which rows it inserted and which it updated.

How small it is

Neither core package depends on the other. This one is written entirely against public seams they each expose for their own reasons:

  • IBulkWriteObserver (from EF.Toolkit.Bulk) sees the entities, values and before-images of an explicit bulk operation, inside its transaction — equally useful for an outbox or a projection.
  • IAuditEntryFactory (from EF.Toolkit.Audit) turns a described change into audit entries, so any capture path produces entries identical to the change tracker's.
  • IAuditBatchWriter (from EF.Toolkit.Audit) is an optional faster path for writing many entries at once.

This package implements the first in terms of the second, and the third in terms of BulkInsertAsync. That is the whole of the integration.

Correctness

The differential harness runs the same logical change twice — once through SaveChanges(), once through the explicit bulk API — and requires the resulting audit entries to be identical. Anything less would make an audited bulk write a second-class record.

Full documentation

The EF.Toolkit.Audit documentation covers registration, actors, multi-tenancy, the payload and the audit table.

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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.

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
10.0.0-alpha.7 92 10/18/2026
10.0.0-alpha.6 236 8/18/2026
10.0.0-alpha.5 98 8/15/2026
10.0.0-alpha.4 89 8/14/2026
10.0.0-alpha.3 85 8/14/2026