Table of Contents

Class EfCoreTracedAggregateRepository<TEntity, TKey>

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

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

public class EfCoreTracedAggregateRepository<TEntity, TKey> : ITracedAggregateRepository<TEntity, TKey>, IReadableRepository<TEntity, TKey>, IWritableRepository<TEntity, TKey>, IRepository<TEntity, TKey> where TEntity : class, IEntity<TKey>, ITracedAggregateRoot<TKey>

Type Parameters

TEntity

The type of the entity that implements the ITracedAggregateRoot<TKey> interface.

TKey

The type of the key that uniquely identifies the entity.

Inheritance
EfCoreTracedAggregateRepository<TEntity, TKey>
Implements
IReadableRepository<TEntity, TKey>
IWritableRepository<TEntity, TKey>
IRepository<TEntity, TKey>
Derived

Constructors

EfCoreTracedAggregateRepository(IEfCoreDataSource, IMarshaller)

Initializes a new instance of the EfCoreTracedAggregateRepository<TEntity, TKey> class.

public EfCoreTracedAggregateRepository(IEfCoreDataSource source, IMarshaller marshaller)

Parameters

source IEfCoreDataSource

The IEfCoreDataSource that handles actual I/O communication with a source of data.

marshaller IMarshaller

The IMarshaller that is used when converting between ITracedDomainEvent and arbitrary data.

Methods

Add(TEntity)

Marks the specified entity to be added in the data store when SaveChangesAsync(Action<AsyncOptions>) is called.

public void Add(TEntity entity)

Parameters

entity TEntity

The aggregate to add.

AddRange(IEnumerable<TEntity>)

Marks the specified entities to be added in the data store when SaveChangesAsync(Action<AsyncOptions>) is called.

public void AddRange(IEnumerable<TEntity> entities)

Parameters

entities IEnumerable<TEntity>

The aggregates to add.

GetByIdAsync(TKey, Action<AsyncOptions>)

Loads an aggregate from the specified id asynchronous.

public Task<TEntity> GetByIdAsync(TKey id, Action<AsyncOptions> setup = null)

Parameters

id TKey

The key that uniquely identifies the aggregate.

setup Action<AsyncOptions>

The AsyncOptions which may be configured.

Returns

Task<TEntity>

A Task<TResult> that represents the asynchronous operation. The task result either contains the entity of the operation or null if not found.

Exceptions

MissingMethodException

TEntity does not have a suitable constructor.

See Also

IReadableRepository<TEntity, TKey>
IWritableRepository<TEntity, TKey>