API reference — Workflows
Nuvora.Nexus.Relay.Sagas.EfCore
EF Core (PostgreSQL) saga store for Nuvora Nexus Relay
dotnet add package Nuvora.Nexus.Relay.Sagas.EfCore
Nuvora.Nexus.Relay.Sagas.EfCore
EfCoreSagaReadStore<TContext>
public sealed class EfCoreSagaReadStore<TContext> : ISagaReadStore where TContext : DbContext
EF Core (PostgreSQL) read-only saga store. Opens short-lived contexts from an IDbContextFactory so it is safe to poll from a background monitoring loop (the transactional EfCoreSagaRepository can only run inside a command’s ambient context).
Constructors
EfCoreSagaReadStore(IDbContextFactory<TContext> contextFactory)
Methods
Task<IReadOnlyList<SagaSummary>> ListAsync(string? sagaType = null, SagaStatus? status = null, int maxCount = 100, CancellationToken cancellationToken = default(CancellationToken))
List saga instances, newest-updated first, optionally filtered by type and/or status.
Task<SagaCounts> CountAsync(CancellationToken cancellationToken = default(CancellationToken))
Aggregate counts grouped by status across all saga types.
EfCoreSagaRepository
public sealed class EfCoreSagaRepository : ISagaRepository
EF Core saga repository. All operations run on the command’s shared DbContext (via IRelayDbContextAccessor), so the saga-state save commits in the same transaction as the outbox/scheduler rows the saga produced. Lookups track the entity so the optimistic Version token is enforced on save.
Constructors
EfCoreSagaRepository(IRelayDbContextAccessor accessor)
Methods
Task<SagaRecord?> FindAsync(string sagaType, string correlationKey, Guid? tenantId, CancellationToken cancellationToken = default(CancellationToken))
Find the live instance for a correlation within a tenant (tracked), or null.
Task<SagaRecord?> FindByIdAsync(string sagaType, Guid sagaId, CancellationToken cancellationToken = default(CancellationToken))
Find an instance by id (tracked), or null.
void Add(SagaRecord saga)
Stage a new instance (insert).
void Update(SagaRecord saga)
Stage an update to a tracked instance (the concurrency token guards the write).
Nuvora.Nexus.Relay.Sagas.EfCore.DependencyInjection
SagaServiceCollectionExtensions
public static class SagaServiceCollectionExtensions
Registration helper for the EF Core saga repository.
Methods
static IServiceCollection AddRelaySagasEfCore(this IServiceCollection services)
Registers the EF Core saga repository. Requires the event-store accessor (AddRelayEventStoreEfCore) and the host context to call ApplyRelaySagas() in OnModelCreating.
static IServiceCollection AddRelaySagasReadStore<TContext>(this IServiceCollection services)
Registers the background-safe read-only saga store (ISagaReadStore) for monitoring dashboards. Requires a registered IDbContextFactory for the host context (the same one used by the EF Core outbox/scheduler stores).
Nuvora.Nexus.Relay.Sagas.EfCore.Persistence
SagaModelBuilderExtensions
public static class SagaModelBuilderExtensions
Maps the saga table (relay_sagas) onto the host’s DbContext.
Methods
static ModelBuilder ApplyRelaySagas(this ModelBuilder modelBuilder)