Docs
Tenantry ProAPI reference

IAuditStore interface

Namespace: Tenantry.Pro.EfCore.Audit · Package: Tenantry.Pro.EfCore · API reference

Receives audit entries produced by Tenantry.Pro.EfCore.Audit after each successful EF Core SaveChanges call.

The default implementation logs entries to ILogger. Replace it with your own implementation to persist entries to a database, event stream, or external audit service:

builder.Services.AddSingleton<IAuditStore, MyDatabaseAuditStore>();

Register the replacement after calling pro.AddAuditLogging() to override the default.

public interface IAuditStore

Methods

SaveAsync(IReadOnlyList<AuditEntry>, CancellationToken)

Persists or dispatches the supplied audit entries. Called once per SaveChanges call that produced at least one auditable change.

Task SaveAsync(IReadOnlyList<AuditEntry> entries, CancellationToken cancellationToken = default)

Parameters:

  • entries IReadOnlyList<AuditEntry>: The entries recorded in this save operation. Never empty.
  • cancellationToken CancellationToken: A cancellation token.

Returns: Task

On this page