Skip to main content
Table of Contents

Class WriteUnitOfWork<TDbContext>

Namespace
Stratara.EventSourcing.EntityFrameworkCore.WriteStore
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

TDbContext

The 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

contextFactory IDbContextFactory<TDbContext>

Factory used to create a new DbContext per transaction.

sessionContextProvider ISessionContextProvider

Provides the ambient session context used by the command-audit repository.

serializer ISecureJsonSerializer

Secure 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

transaction ITransaction

Returns

ICommandAuditRepository

CreateEventChainRepository(ITransaction)

Repository over event_chain_anchor for this transaction.

public IEventChainRepository CreateEventChainRepository(ITransaction transaction)

Parameters

transaction ITransaction

Returns

IEventChainRepository

CreateEventStreamRepository(ITransaction)

Repository over event_stream_entry for this transaction.

public IEventStreamRepository CreateEventStreamRepository(ITransaction transaction)

Parameters

transaction ITransaction

Returns

IEventStreamRepository

CreateOutboxRepository(ITransaction)

Repository over outbox_entry for this transaction.

public IOutboxRepository CreateOutboxRepository(ITransaction transaction)

Parameters

transaction ITransaction

Returns

IOutboxRepository

CreateSnapshotRepository(ITransaction)

Repository over snapshot for this transaction.

public ISnapshotRepository CreateSnapshotRepository(ITransaction transaction)

Parameters

transaction ITransaction

Returns

ISnapshotRepository