DKNet.EfCore.Hooks
13.3.1
See the version list below for details.
dotnet add package DKNet.EfCore.Hooks --version 13.3.1
NuGet\Install-Package DKNet.EfCore.Hooks -Version 13.3.1
<PackageReference Include="DKNet.EfCore.Hooks" Version="13.3.1" />
<PackageVersion Include="DKNet.EfCore.Hooks" Version="13.3.1" />
<PackageReference Include="DKNet.EfCore.Hooks" />
paket add DKNet.EfCore.Hooks --version 13.3.1
#r "nuget: DKNet.EfCore.Hooks, 13.3.1"
#:package DKNet.EfCore.Hooks@13.3.1
#addin nuget:?package=DKNet.EfCore.Hooks&version=13.3.1
#tool nuget:?package=DKNet.EfCore.Hooks&version=13.3.1
DKNet.EfCore.Hooks
A before/after SaveChangesAsync hook pipeline for .NET developers adding cross-cutting persistence work.
✨ Why use it?
- Share one captured change set between audit, event, ownership and custom hooks.
- Resolve hooks from the context DI scope and inherit hook registrations from base context types.
- Suppress all hooks for a bounded seeding or migration flow.
🚀 Quick Start
Use a .NET 10 console project. Install the package, then replace Program.cs with the example.
dotnet new console -f net10.0 -n EfCoreDemo
cd EfCoreDemo
dotnet add package DKNet.EfCore.Hooks
dotnet add package Microsoft.EntityFrameworkCore.Sqlite --version 10.0.12
using Microsoft.EntityFrameworkCore;
using DKNet.EfCore.Hooks;
using Microsoft.Extensions.DependencyInjection;
using var connection = new Microsoft.Data.Sqlite.SqliteConnection("Data Source=:memory:");
connection.Open();
var services = new Microsoft.Extensions.DependencyInjection.ServiceCollection();
services.AddLogging();
services.AddDbContextWithHook<DemoDb>(o => o.UseSqlite(connection));
services.AddHook<DemoDb, ReportHook>();
using var provider = services.BuildServiceProvider();
using var scope = provider.CreateScope();
await using var db = scope.ServiceProvider.GetRequiredService<DemoDb>();
await db.Database.EnsureCreatedAsync();
db.Add(new Item { Name = "Coffee" });
await db.SaveChangesAsync(); // before: 1, then after: 1
public sealed class DemoDb(DbContextOptions<DemoDb> options) : DbContext(options)
{
public DbSet<Item> Items => Set<Item>();
}
public sealed class Item
{
public int Id { get; set; }
public string Name { get; set; } = "";
}
public sealed class ReportHook : HookAsync
{
public override Task BeforeSaveAsync(DKNet.EfCore.Extensions.Snapshots.SnapshotContext snapshot,
CancellationToken cancellationToken = default)
{
Console.WriteLine($"before: {snapshot.Entities.Count}");
return Task.CompletedTask;
}
public override Task AfterSaveAsync(DKNet.EfCore.Extensions.Snapshots.SnapshotContext snapshot,
CancellationToken cancellationToken = default)
{
Console.WriteLine($"after: {snapshot.Entities.Count}");
return Task.CompletedTask;
}
}
Run with dotnet run.
Documentation
| Guide | Read when |
|---|---|
| Package overview | Start with architecture and the end-to-end flow. |
| Run custom work before and after an async save | Implement a hook interface or derive from HookAsync to inspect the shared snapshot around a save. |
| Suppress hooks for a bounded async flow | Wrap saves in a disposable DisableHooks() scope when a batch must bypass every hook for that context type. |
| Product | Versions 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. |
-
net10.0
- DKNet.EfCore.Extensions (>= 13.3.1)
- DKNet.Fw.Extensions (>= 13.3.1)
- Microsoft.EntityFrameworkCore (>= 10.0.12)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on DKNet.EfCore.Hooks:
| Package | Downloads |
|---|---|
|
DKNet.EfCore.Events
DKNet is an enterprise-grade .NET library collection focused on advanced EF Core extensions, dynamic predicate building, and the Specification pattern. It provides production-ready tools for building robust, type-safe, and testable data access layers, including dynamic LINQ support, LinqKit integration. Designed for modern cloud-native applications, DKNet enforces strict code quality, async best practices, and full documentation for all public APIs. Enterprise-grade .NET library suite for modern application development, featuring advanced EF Core extensions (dynamic predicates, specifications, LinqKit), robust Domain-Driven Design (DDD) patterns, and domain event support. DKNet empowers scalable, maintainable, and testable solutions with type-safe validation, async/await, XML documentation, and high code quality standards. Ideal for cloud-native, microservices, and enterprise architectures. |
|
|
DKNet.EfCore.DataAuthorization
DKNet is an enterprise-grade .NET library collection focused on advanced EF Core extensions, dynamic predicate building, and the Specification pattern. It provides production-ready tools for building robust, type-safe, and testable data access layers, including dynamic LINQ support, LinqKit integration. Designed for modern cloud-native applications, DKNet enforces strict code quality, async best practices, and full documentation for all public APIs. Enterprise-grade .NET library suite for modern application development, featuring advanced EF Core extensions (dynamic predicates, specifications, LinqKit), robust Domain-Driven Design (DDD) patterns, and domain event support. DKNet empowers scalable, maintainable, and testable solutions with type-safe validation, async/await, XML documentation, and high code quality standards. Ideal for cloud-native, microservices, and enterprise architectures. |
|
|
DKNet.EfCore.AuditLogs
DKNet is an enterprise-grade .NET library collection focused on advanced EF Core extensions, dynamic predicate building, and the Specification pattern. It provides production-ready tools for building robust, type-safe, and testable data access layers, including dynamic LINQ support, LinqKit integration. Designed for modern cloud-native applications, DKNet enforces strict code quality, async best practices, and full documentation for all public APIs. Enterprise-grade .NET library suite for modern application development, featuring advanced EF Core extensions (dynamic predicates, specifications, LinqKit), robust Domain-Driven Design (DDD) patterns, and domain event support. DKNet empowers scalable, maintainable, and testable solutions with type-safe validation, async/await, XML documentation, and high code quality standards. Ideal for cloud-native, microservices, and enterprise architectures. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 13.3.2 | 161 | 11/3/2026 |
| 13.3.1 | 165 | 10/26/2026 |
| 13.3.0 | 232 | 10/22/2026 |
| 13.2.8 | 149 | 10/22/2026 |
| 13.2.7 | 193 | 10/11/2026 |
| 13.2.6 | 147 | 10/10/2026 |
| 13.2.5 | 396 | 10/2/2026 |
| 13.2.4 | 136 | 10/1/2026 |
| 13.2.3 | 156 | 10/1/2026 |
| 13.2.2 | 147 | 10/1/2026 |
| 13.2.1 | 149 | 10/1/2026 |
| 13.2.0 | 145 | 10/1/2026 |
| 13.1.3 | 222 | 9/21/2026 |
| 13.1.2 | 421 | 9/18/2026 |
| 13.1.1 | 157 | 9/18/2026 |
| 13.1.0 | 141 | 9/18/2026 |
| 13.0.2 | 145 | 9/18/2026 |
| 13.0.1 | 158 | 9/18/2026 |
| 13.0.0 | 159 | 9/18/2026 |
| 12.0.0 | 170 | 9/17/2026 |