-
Notifications
You must be signed in to change notification settings - Fork 0
Event Store Usage
Kieron Lanning edited this page Apr 16, 2026
·
1 revision
The repository sample intentionally uses the non-generic facades:
IEventStoreIQueryableEventStore
These facades expose generic convenience methods through extension methods, which keeps application code compact while preserving provider-agnostic behavior.
var order = await store.CreateAsync<OrderAggregate>(cancellationToken: cancellationToken);
var existing = await store.GetAsync<OrderAggregate>(orderId, cancellationToken);
var historical = await store.GetAtAsync<OrderAggregate>(orderId, version: 3, cancellationToken);
await store.SaveAsync(order, cancellationToken);
await store.DeleteAsync(order, cancellationToken);
await store.RestoreAsync(order, cancellationToken);var total = await store.CountAsync<OrderAggregate>(o => !o.Details.IsDeleted, cancellationToken);
var first = await store.FirstOrDefaultAsync<OrderAggregate>(
o => o.CustomerId == customerId,
cancellationToken);
var page = await store.QueryAsync<OrderAggregate>(
o => o.CustomerId == customerId,
q => q.OrderByDescending(o => o.Details.SavedVersion),
new ContinuationRequest { MaxRecords = 25 },
cancellationToken);Most overloads accept EventStoreOperationContext for correlation IDs, causation IDs, principals, and other request-specific metadata.
If you do not supply one, the default context is used.
The framework supports soft deletion patterns:
IsDeletedAsync<T>()GetDeletedAsync<T>()DeleteAsync<T>()RestoreAsync<T>()
Queryable stores make deleted-aggregate administration scenarios easier to implement, and the sample back-office pages demonstrate those flows.