Class WriteUnitOfWork<TDbContext>
- Assembly
- Stratara.EventSourcing.EntityFrameworkCore.dll
Write-side unit of work that mints repositories for the event-sourcing tables — IEventStreamRepository, IEventChainRepository, ISnapshotRepository, ICommandAuditRepository, and IOutboxRepository — all sharing the same EF Core transaction.
public class WriteUnitOfWork<TDbContext> : UnitOfWork<TDbContext>, IWriteUnitOfWork, IUnitOfWork where TDbContext : DbContext, IWriteDbContext
Type Parameters
TDbContextThe concrete write-store DbContext type.
- Inheritance
-
UnitOfWork<TDbContext>WriteUnitOfWork<TDbContext>
- Implements
- Inherited Members
- Extension Methods
Constructors
WriteUnitOfWork(IDbContextFactory<TDbContext>, ISessionContextProvider, ISecureJsonSerializer)
Write-side unit of work that mints repositories for the event-sourcing tables — IEventStreamRepository, IEventChainRepository, ISnapshotRepository, ICommandAuditRepository, and IOutboxRepository — all sharing the same EF Core transaction.
public WriteUnitOfWork(IDbContextFactory<TDbContext> contextFactory, ISessionContextProvider sessionContextProvider, ISecureJsonSerializer serializer)
Parameters
contextFactoryIDbContextFactory<TDbContext>Factory used to create a new DbContext per transaction.
sessionContextProviderISessionContextProviderProvides the ambient session context used by the command-audit repository.
serializerISecureJsonSerializerSecure JSON serializer used by the command-audit repository to encrypt command payloads.
Methods
CreateCommandAuditRepository(ITransaction)
Repository over command_log_entry for this transaction.
public ICommandAuditRepository CreateCommandAuditRepository(ITransaction transaction)
Parameters
transactionITransaction
Returns
CreateEventChainRepository(ITransaction)
Repository over event_chain_anchor for this transaction.
public IEventChainRepository CreateEventChainRepository(ITransaction transaction)
Parameters
transactionITransaction
Returns
CreateEventStreamRepository(ITransaction)
Repository over event_stream_entry for this transaction.
public IEventStreamRepository CreateEventStreamRepository(ITransaction transaction)
Parameters
transactionITransaction
Returns
CreateOutboxRepository(ITransaction)
Repository over outbox_entry for this transaction.
public IOutboxRepository CreateOutboxRepository(ITransaction transaction)
Parameters
transactionITransaction
Returns
CreateSnapshotRepository(ITransaction)
Repository over snapshot for this transaction.
public ISnapshotRepository CreateSnapshotRepository(ITransaction transaction)
Parameters
transactionITransaction