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
TAggregateThe aggregate type.
- Inheritance
-
EventSourcedRepository<TAggregate, string>EventSourcedRepository<TAggregate>
- Implements
-
IEventSourcedRepository<TAggregate>IEventSourcedRepository<TAggregate, string>
- 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
eventStoreIEventStoreThe event store for persistence.
eventSerializerIEventSerializerThe event serializer for deserialization.
aggregateFactoryFunc<string, TAggregate>Factory function to create aggregate instances from a string key.
optionsIOptions<EventSourcedRepositoryOptions>Configuration options for the repository.
autoSnapshotOptionsIOptionsMonitor<AutoSnapshotOptions>Optional auto-snapshot configuration for automatic snapshot creation after save.
upcastingPipelineIUpcastingPipelineOptional upcasting pipeline for version transformation.
snapshotManagerISnapshotManagerOptional snapshot manager.
snapshotStrategyISnapshotStrategyOptional snapshot strategy.
transactionalOutboxWriterITransactionalOutboxWriterOptional transactional outbox writer for staging integration events atomically with event appends.
outboxStoreIOutboxStoreOptional outbox store for eventually-consistent staging when transactional writer is unavailable.
snapshotVersionManagerSnapshotVersionManagerOptional snapshot version manager for automatic snapshot upgrading.
eventNotificationBrokerIEventNotificationBrokerOptional broker for the post-commit notification handlers.
timeProviderTimeProviderOptional time provider for deterministic testing.
loggerILogger<EventSourcedRepository<TAggregate, string>>Optional logger for diagnostics.