Table of Contents

Namespace Savvyio.Extensions.EFCore.Domain.EventSourcing

Assembly: Savvyio.Extensions.EFCore.Domain.EventSourcing.dll

EF Core–backed event sourcing requires both a schema setup and a repository that writes individual event rows. The Savvyio.Extensions.EFCore.Domain.EventSourcing namespace provides all three: the EF Core entity, the repository, and the ModelBuilder extension that creates the event-store table.

Start with ModelBuilderExtensions.AddEventSourcing<TEntity, TKey> in OnModelCreating to create the event table. Then use EfCoreTracedAggregateRepository<TAggregateRoot, TKey, TContext> as the aggregate repository. Use EfCoreTracedAggregateEntityExtensions.ToTracedDomainEvent<TEntity, TKey> to hydrate domain events from stored rows, and TracedDomainEventExtensions.ToByteArray to serialize a traced event for storage. Register with Savvyio.Extensions.DependencyInjection.EFCore.Domain.EventSourcing.

Availability: .NET 10 and .NET 9

Extension Members

Type Ext Methods
EfCoreTracedAggregateEntity<TEntity, TKey> ⬇️ ToTracedDomainEvent<TEntity, TKey>
ITracedDomainEvent ⬇️ ToByteArray
ModelBuilder ⬇️ AddEventSourcing<TEntity, TKey>

Classes

EfCoreTracedAggregateEntityExtensions

Extension methods for the EfCoreTracedAggregateEntity<TEntity, TKey> class.

EfCoreTracedAggregateEntityOptions

Configuration options for EfCoreTracedAggregateEntity<TEntity, TKey>.

EfCoreTracedAggregateEntity<TEntity, TKey>

Provides a generic way for EF Core to surrogate and support an implementation of ITracedAggregateRoot<TKey>.

EfCoreTracedAggregateRepository<TEntity, TKey>

Provides an implementation of the EfCoreRepository<TEntity, TKey> that is optimized for Domain Driven Design and Event Sourcing.

ModelBuilderExtensions

Extension methods for the ModelBuilder class.

TracedDomainEventExtensions

Extension methods for the ITracedDomainEvent interface.