Table of Contents

Class EventSourcedRepository<TAggregate>

Namespace
Excalibur.EventSourcing.Implementation
Assembly
Excalibur.EventSourcing.dll

Event-sourced repository implementation for aggregates with string keys. This is a convenience class that wraps EventSourcedRepository<TAggregate, TKey> with a string key type.

public class EventSourcedRepository<TAggregate> : EventSourcedRepository<TAggregate, string>, IEventSourcedRepository<TAggregate>, IEventSourcedRepository<TAggregate, string> where TAggregate : class, IAggregateRoot<string>, IAggregateSnapshotSupport

Type Parameters

TAggregate

The aggregate type.

Inheritance
EventSourcedRepository<TAggregate>
Implements
Inherited Members

Remarks

Use this class when your aggregates use string identifiers. For other key types, use EventSourcedRepository<TAggregate, TKey> directly.

Constructors

EventSourcedRepository(IEventStore, IEventSerializer, Func<string, TAggregate>, IOptions<EventSourcedRepositoryOptions>, IOptionsMonitor<AutoSnapshotOptions>?, IUpcastingPipeline?, ISnapshotManager?, ISnapshotStrategy?, ITransactionalOutboxWriter?, IOutboxStore?, SnapshotVersionManager?, IEventNotificationBroker?, TimeProvider?, ILogger<EventSourcedRepository<TAggregate, string>>?)

Initializes a new instance of the EventSourcedRepository<TAggregate> class using the Options pattern for configuration.

public EventSourcedRepository(IEventStore eventStore, IEventSerializer eventSerializer, Func<string, TAggregate> aggregateFactory, IOptions<EventSourcedRepositoryOptions> options, IOptionsMonitor<AutoSnapshotOptions>? autoSnapshotOptions = null, IUpcastingPipeline? upcastingPipeline = null, ISnapshotManager? snapshotManager = null, ISnapshotStrategy? snapshotStrategy = null, ITransactionalOutboxWriter? transactionalOutboxWriter = null, IOutboxStore? outboxStore = null, SnapshotVersionManager? snapshotVersionManager = null, IEventNotificationBroker? eventNotificationBroker = null, TimeProvider? timeProvider = null, ILogger<EventSourcedRepository<TAggregate, string>>? logger = null)

Parameters

eventStore IEventStore

The event store for persistence.

eventSerializer IEventSerializer

The event serializer for deserialization.

aggregateFactory Func<string, TAggregate>

Factory function to create aggregate instances from a string key.

options IOptions<EventSourcedRepositoryOptions>

Configuration options for the repository.

autoSnapshotOptions IOptionsMonitor<AutoSnapshotOptions>

Optional auto-snapshot configuration for automatic snapshot creation after save.

upcastingPipeline IUpcastingPipeline

Optional upcasting pipeline for version transformation.

snapshotManager ISnapshotManager

Optional snapshot manager.

snapshotStrategy ISnapshotStrategy

Optional snapshot strategy.

transactionalOutboxWriter ITransactionalOutboxWriter

Optional transactional outbox writer for staging integration events atomically with event appends.

outboxStore IOutboxStore

Optional outbox store for eventually-consistent staging when transactional writer is unavailable.

snapshotVersionManager SnapshotVersionManager

Optional snapshot version manager for automatic snapshot upgrading.

eventNotificationBroker IEventNotificationBroker

Optional broker for the post-commit notification handlers.

timeProvider TimeProvider

Optional time provider for deterministic testing.

logger ILogger<EventSourcedRepository<TAggregate, string>>

Optional logger for diagnostics.