Class MediatorEventSourceRepository
An IAsyncEventSourceRepository implementation that uses IMediator to invoke event handlers in-process. This makes it possible to have a very simple event support, but lacks the reliability of a full implementation.
Inherited Members
Namespace: IRM.Domain.Persistance
Assembly: IRM.dll
Syntax
public class MediatorEventSourceRepository : IAsyncEventSourceRepository, IEventSourceRepository, IDisposable
Constructors
MediatorEventSourceRepository(IMediator, ICurrentPrincipalAccessor, ITenantAccessor)
Creates a new instance of MediatorEventSourceRepository.
Declaration
public MediatorEventSourceRepository(IMediator mediator, ICurrentPrincipalAccessor currentPrincipalAccessor, ITenantAccessor tenantAccessor)
Parameters
IMediator
mediator
The IMediator |
ICurrentPrincipalAccessor
currentPrincipalAccessor
The ICurrentPrincipalAccessor used to access the |
ITenantAccessor
tenantAccessor
|
Methods
Dispose()
Declaration
public void Dispose()
Implements
Dispose(Boolean)
Finalize()
Declaration
protected void Finalize()
Save(IEventSourced, Guid, IMetadataProvider[])
Saves all events created by an aggregate in the event store.
Declaration
public void Save(IEventSourced aggregate, Guid commitId, params IMetadataProvider[] metadataProviders)
Parameters
IEventSourced
aggregate
The aggregate that implements IEventSourced. |
System.Guid
commitId
A unique identifier for this commit (save). |
IMetadataProvider[]
metadataProviders
Zero, one or more IMetadataProvider used to get metadata that can be stored together with the events. |
Implements
Save(IEvent, Guid, IMetadataProvider[])
Saves a single event in the event store.
Declaration
public void Save(IEvent event, Guid commitId, params IMetadataProvider[] metadataProviders)
Parameters
IEvent
event
The IEvent to store in the event store. |
System.Guid
commitId
A unique identifier for this commit (save). |
IMetadataProvider[]
metadataProviders
Zero, one or more IMetadataProvider used to get metadata that can be stored together with the events. |
Implements
SaveAsync(IEventSourced, Guid, CancellationToken, IMetadataProvider[])
An asynchronous version of Save(IEventSourced, Guid, IMetadataProvider[]), which saves all events created by an aggregate in the event store.
Declaration
public async Task SaveAsync(IEventSourced aggregate, Guid commitId, CancellationToken cancellationToken = default(CancellationToken), params IMetadataProvider[] metadataProviders)
Parameters
IEventSourced
aggregate
The aggregate that implements IEventSourced. |
System.Guid
commitId
A unique identifier for this commit (save). |
System.Threading.CancellationToken
cancellationToken
The cancellation instruction. |
IMetadataProvider[]
metadataProviders
Zero, one or more IMetadataProvider used to get metadata that can be stored together with the events. |
Returns
System.Threading.Tasks.Task
A task representing the asynchronous operation. |
Implements
SaveAsync(IEvent, Guid, CancellationToken, IMetadataProvider[])
An asynchronous version of Save(IEvent, Guid, IMetadataProvider[]), which saves a single event in the event store.
Declaration
public Task SaveAsync(IEvent event, Guid commitId, CancellationToken cancellationToken = default(CancellationToken), params IMetadataProvider[] metadataProviders)
Parameters
IEvent
event
The IEvent to store in the event store. |
System.Guid
commitId
A unique identifier for this commit (save). |
System.Threading.CancellationToken
cancellationToken
The cancellation instruction. |
IMetadataProvider[]
metadataProviders
Zero, one or more IMetadataProvider used to get metadata that can be stored together with the events. |
Returns
System.Threading.Tasks.Task
A task representing the asynchronous operation. |
Implements
Explicit Interface Implementations
IAsyncEventSourceRepository.GetByIdAsync<TAggregate>(Guid, DateTime, CancellationToken)
Declaration
Task<TAggregate> IAsyncEventSourceRepository.GetByIdAsync<TAggregate>(Guid id, DateTime loadUntilDate, CancellationToken cancellationToken)
where TAggregate : class, IEventSourced
Parameters
System.Guid
id
|
System.DateTime
loadUntilDate
|
System.Threading.CancellationToken
cancellationToken
|
Returns
System.Threading.Tasks.Task<TAggregate>
|
Type Parameters
TAggregate
|
Implements
IAsyncEventSourceRepository.GetByIdAsync<TAggregate>(Guid, Int32, CancellationToken)
Declaration
Task<TAggregate> IAsyncEventSourceRepository.GetByIdAsync<TAggregate>(Guid id, int version, CancellationToken cancellationToken)
where TAggregate : class, IEventSourced
Parameters
System.Guid
id
|
System.Int32
version
|
System.Threading.CancellationToken
cancellationToken
|
Returns
System.Threading.Tasks.Task<TAggregate>
|
Type Parameters
TAggregate
|
Implements
IEventSourceRepository.GetById<TAggregate>(Guid, DateTime)
Declaration
TAggregate IEventSourceRepository.GetById<TAggregate>(Guid id, DateTime loadUntilDate)
where TAggregate : class, IEventSourced
Parameters
System.Guid
id
|
System.DateTime
loadUntilDate
|
Returns
TAggregate
|
Type Parameters
TAggregate
|
Implements
IEventSourceRepository.GetById<TAggregate>(Guid, Int32)
Declaration
TAggregate IEventSourceRepository.GetById<TAggregate>(Guid id, int version)
where TAggregate : class, IEventSourced
Parameters
System.Guid
id
|
System.Int32
version
|
Returns
TAggregate
|
Type Parameters
TAggregate
|