Table of Contents

Class EfCoreAuditLedgerStore

Namespace
AsiBackbone.EntityFrameworkCore.Audit
Assembly
AsiBackbone.EntityFrameworkCore.dll

Entity Framework Core-backed audit ledger store that persists records through a host-owned DbContext.

public sealed class EfCoreAuditLedgerStore : IGovernanceAuditLedgerStore
Inheritance
EfCoreAuditLedgerStore
Implements
Inherited Members

Remarks

This store is append-oriented and intentionally relies on the host application to expose the ASI Backbone entities from its own DbContext and migrations. It does not create a package-owned context or select a database provider.

Constructors

EfCoreAuditLedgerStore(DbContext, ILogger<EfCoreAuditLedgerStore>?)

Initializes a new instance of the EfCoreAuditLedgerStore class.

public EfCoreAuditLedgerStore(DbContext dbContext, ILogger<EfCoreAuditLedgerStore>? logger = null)

Parameters

dbContext DbContext

The host-owned database context.

logger ILogger<EfCoreAuditLedgerStore>

The optional host-owned logger used for internal persistence diagnostics.

Methods

AppendAsync(AuditLedgerRecord, CancellationToken)

Appends an audit ledger record to durable host-owned storage.

public ValueTask<OperationResult<AuditLedgerRecord>> AppendAsync(AuditLedgerRecord record, CancellationToken cancellationToken = default)

Parameters

record AuditLedgerRecord

The record to append.

cancellationToken CancellationToken

A token that can cancel the append operation.

Returns

ValueTask<OperationResult<AuditLedgerRecord>>

The append operation result.

FindByActorIdAsync(string, CancellationToken)

Finds audit ledger records associated with an actor identifier.

public ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByActorIdAsync(string actorId, CancellationToken cancellationToken = default)

Parameters

actorId string

The actor identifier.

cancellationToken CancellationToken

A token that can cancel the lookup operation.

Returns

ValueTask<IReadOnlyList<AuditLedgerRecord>>

The matching audit ledger records.

FindByCorrelationIdAsync(string, CancellationToken)

Finds audit ledger records associated with a correlation identifier.

public ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByCorrelationIdAsync(string correlationId, CancellationToken cancellationToken = default)

Parameters

correlationId string

The correlation identifier.

cancellationToken CancellationToken

A token that can cancel the lookup operation.

Returns

ValueTask<IReadOnlyList<AuditLedgerRecord>>

The matching audit ledger records.

FindByRecordIdAsync(string, CancellationToken)

Finds an audit ledger record by its stable record identifier.

public ValueTask<AuditLedgerRecord?> FindByRecordIdAsync(string recordId, CancellationToken cancellationToken = default)

Parameters

recordId string

The stable record identifier.

cancellationToken CancellationToken

A token that can cancel the lookup operation.

Returns

ValueTask<AuditLedgerRecord>

The matching record, or null when no record exists.

FindByRecordedUtcRangeAsync(DateTimeOffset, DateTimeOffset, CancellationToken)

Finds audit ledger records recorded within the inclusive UTC date range.

public ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByRecordedUtcRangeAsync(DateTimeOffset recordedFromUtc, DateTimeOffset recordedToUtc, CancellationToken cancellationToken = default)

Parameters

recordedFromUtc DateTimeOffset

The inclusive lower recorded UTC bound.

recordedToUtc DateTimeOffset

The inclusive upper recorded UTC bound.

cancellationToken CancellationToken

A token that can cancel the lookup operation.

Returns

ValueTask<IReadOnlyList<AuditLedgerRecord>>

The matching audit ledger records.

FindByTraceIdAsync(string, CancellationToken)

Finds audit ledger records associated with a trace identifier.

public ValueTask<IReadOnlyList<AuditLedgerRecord>> FindByTraceIdAsync(string traceId, CancellationToken cancellationToken = default)

Parameters

traceId string

The trace identifier.

cancellationToken CancellationToken

A token that can cancel the lookup operation.

Returns

ValueTask<IReadOnlyList<AuditLedgerRecord>>

The matching audit ledger records.