DKNet.EfCore.AuditLogs
13.3.1
dotnet add package DKNet.EfCore.AuditLogs --version 13.3.1
NuGet\Install-Package DKNet.EfCore.AuditLogs -Version 13.3.1
<PackageReference Include="DKNet.EfCore.AuditLogs" Version="13.3.1" />
<PackageVersion Include="DKNet.EfCore.AuditLogs" Version="13.3.1" />
<PackageReference Include="DKNet.EfCore.AuditLogs" />
paket add DKNet.EfCore.AuditLogs --version 13.3.1
#r "nuget: DKNet.EfCore.AuditLogs, 13.3.1"
#:package DKNet.EfCore.AuditLogs@13.3.1
#addin nuget:?package=DKNet.EfCore.AuditLogs&version=13.3.1
#tool nuget:?package=DKNet.EfCore.AuditLogs&version=13.3.1
DKNet.EfCore.AuditLogs
Capture entity changes and audit identity for .NET developers who supply their own audit-log publisher.
✨ Why use it?
- Record create, update and delete operations without repeating a ChangeTracker walk.
- Redact sensitive property values before they reach your audit sink.
- Attribute changes to the current user while keeping tenant ownership separate.
🚀 Quick Start
Use a .NET 10 console project. Install the packages, then replace Program.cs with the example.
dotnet new console -f net10.0 -n EfCoreDemo
cd EfCoreDemo
dotnet add package DKNet.EfCore.AuditLogs
dotnet add package Microsoft.EntityFrameworkCore.Sqlite --version 10.0.12
using DKNet.EfCore.Abstractions.Entities;
using DKNet.EfCore.AuditLogs;
using DKNet.EfCore.Hooks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using var connection = new Microsoft.Data.Sqlite.SqliteConnection("Data Source=:memory:");
connection.Open();
var services = new ServiceCollection();
services.AddLogging();
services.AddDbContextWithHook<DemoDb>(o => o.UseSqlite(connection));
services.AddEfCoreAuditLogs<DemoDb, ConsolePublisher>();
services.AddCurrentUserProvider<DemoDb, DemoUser>();
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(); // Created: Item, by user-42
public sealed class DemoDb(DbContextOptions<DemoDb> options) : DbContext(options)
{
public DbSet<Item> Items => Set<Item>();
}
public sealed class Item : IAuditedProperties
{
public int Id { get; set; }
public string Name { get; set; } = "";
public string CreatedBy { get; set; } = "";
public DateTimeOffset CreatedOn { get; set; }
public string? UpdatedBy { get; set; }
public DateTimeOffset? UpdatedOn { get; set; }
}
public sealed class DemoUser : ICurrentUserProvider
{
public string? GetCurrentUser() => "user-42";
}
public sealed class ConsolePublisher : IAuditLogPublisher
{
public Task PublishAsync(IEnumerable<AuditLogEntry> logs, CancellationToken cancellationToken = default)
{
foreach (var log in logs)
Console.WriteLine($"{log.Action}: {log.EntityName}, by {log.UpdatedBy ?? log.CreatedBy}");
return Task.CompletedTask;
}
}
Run with dotnet run.
Documentation
| Guide | Read when |
|---|---|
| Package overview | Start with architecture and the end-to-end flow. |
| Capture entity changes | Understand entry metadata and field diffs. |
| Redact sensitive values | Choose entity and property capture rules. |
| Stamp the current user | Fill audit fields before capture. |
| Publish audit batches | Connect one or more scoped sinks. |
| 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.Abstractions (>= 13.3.1)
- DKNet.EfCore.Hooks (>= 13.3.1)
- Microsoft.EntityFrameworkCore (>= 10.0.12)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DKNet.EfCore.AuditLogs:
| Package | Downloads |
|---|---|
|
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. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 13.3.1 | 93 | 10/26/2026 |
| 13.3.0 | 139 | 10/22/2026 |
| 13.2.8 | 101 | 10/22/2026 |
| 13.2.7 | 150 | 10/11/2026 |
| 13.2.6 | 98 | 10/10/2026 |
| 13.2.5 | 324 | 10/2/2026 |
| 13.2.4 | 105 | 10/1/2026 |
| 13.2.3 | 104 | 10/1/2026 |
| 13.2.2 | 101 | 10/1/2026 |
| 13.2.1 | 105 | 10/1/2026 |
| 13.2.0 | 109 | 10/1/2026 |
| 13.1.3 | 142 | 9/21/2026 |
| 13.1.2 | 368 | 9/18/2026 |
| 13.1.1 | 119 | 9/18/2026 |
| 13.1.0 | 105 | 9/18/2026 |
| 13.0.2 | 109 | 9/18/2026 |
| 13.0.1 | 115 | 9/18/2026 |
| 13.0.0 | 120 | 9/18/2026 |
| 12.0.0 | 125 | 9/17/2026 |
| 11.0.0 | 179 | 9/17/2026 |