DKNet

Capture entity changes

Part of DKNet.EfCore.AuditLogs. Use the Quick Start context and publisher. After its first save, update the tracked item:

var item = await db.Items.SingleAsync();
item.Name = "Tea";
await db.SaveChangesAsync(); // Updated: Item, by user-42

EfCoreAuditHook captures eligible tracked states into AuditLogEntry records before EF saves, keeping keys and changed scalar values.

AuditLogEntry contains Action, EntityName, Keys, Changes and the entity’s CreatedBy, CreatedOn, UpdatedBy, UpdatedOn. Each AuditFieldChange has FieldName, OldValue, NewValue; composite primary keys produce multiple Keys entries. AuditLogAction is Created, Updated or Deleted.

🧱 Where it fits

The package architecture shows the shared Hooks snapshot pipeline. Only entities implementing IAuditedProperties are eligible; deriving from AuditedEntity is optional.

⚠️ Gotchas & limits