Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Getting Started with EricksonLopez.Auditing

Install the published 2.0.0 packages from NuGet to capture structured audit entries across HTTP endpoints, domain services, and background workers.

dotnet add package EricksonLopez.Auditing --version 2.0.0

Add a persistence provider or the in-memory testing store as needed:

Terminal window
dotnet add package EricksonLopez.Auditing.PostgreSql --version 2.0.0
dotnet add package EricksonLopez.Auditing.Testing --version 2.0.0

Publication Note: Do not add <PackageReference> entries for EricksonLopez.Auditing.Analyzers, EricksonLopez.Auditing.AzureKeyVault, EricksonLopez.Auditing.Outbox, or EricksonLopez.Auditing.Serilog — all four exist only at local workspace HEAD (3.1.0) and are not published on NuGet.

Both EricksonLopez.Auditing and EricksonLopez.Auditing.Abstractions share the EricksonLopez.Auditing C# namespace. AuditId.NewId() and AuditScope reside in EricksonLopez.Auditing:

using System.Threading.Tasks;
using EricksonLopez.Auditing;
namespace Example.AuditingDocs;
public static class AuditingQuickStart
{
public static async Task<int> RecordAndQueryAsync()
{
var store = new EricksonLopez.Auditing.Testing.InMemoryAuditStore();
using var scope = AuditScope.Begin()
.WithTenant("tenant-acme")
.WithCorrelationId("corr-1001")
.WithMetadata("Channel", "API");
AuditRecord record = AuditRecordBuilder.Create()
.WithId(AuditId.NewId())
.WithActor(AuditActorType.User, "user-42", "Alice")
.WithAction(AuditAction.Update)
.WithResource("Order", "ord-99")
.AddChange("Status", "Pending", "Approved")
.WithOutcome(AuditOutcome.Success)
.Build();
await store.AppendAsync(record);
AuditQueryResult page = await store.QueryAsync(new AuditQuery
{
TenantId = new TenantId("tenant-acme"),
ResourceType = "Order",
PageSize = 25
});
return page.Records.Count;
}
}

Prefer reading page.Records, page.HasMore, and page.NextPageToken properties instead of positional tuple deconstruction so code stays compatible across 2.0.0 (3 constructor parameters) and local 3.x (TotalCount = null 4th parameter).