DKNet

Publish audit batches

Part of DKNet.EfCore.AuditLogs. The Quick Start publisher implements IAuditLogPublisher.PublishAsync. To register several sinks, replace its one-call publisher registration with:

services.AddEfCoreAuditHook<DemoDb>();
services.AddKeyedScoped<IAuditLogPublisher, ConsolePublisher>(typeof(DemoDb).FullName!);

After a successful EF save the hook removes the in-memory batch, awaits each keyed publisher, and logs an individual failure before continuing.

Add another keyed scoped registration for each additional publisher implementation. Resolve the registered sinks with scope.ServiceProvider.GetAuditLogPublishers<DemoDb>() when needed. AddEfCoreAuditLogs<TDbContext, TPublisher>() combines publisher and hook registration and ignores a duplicate of the same publisher for the same key.

🧱 Where it fits

The package architecture places the publisher adapter at the host boundary. Your implementation owns persistence, transport and retention; this package owns capture and invocation.

⚠️ Gotchas & limits