Show / Hide Table of Contents

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.

Inheritance
Object
MediatorEventSourceRepository
Inherited Members
System.Object.ToString()
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
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
System.IDisposable.Dispose()

Dispose(Boolean)

Declaration
protected void Dispose(bool disposing)
Parameters
Boolean disposing

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
IEventSourceRepository.Save(IEventSourced, Guid, IMetadataProvider[])

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
IEventSourceRepository.Save(IEvent, Guid, IMetadataProvider[])

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
IAsyncEventSourceRepository.SaveAsync(IEventSourced, Guid, CancellationToken, IMetadataProvider[])

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
IAsyncEventSourceRepository.SaveAsync(IEvent, Guid, CancellationToken, IMetadataProvider[])

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, DateTime, CancellationToken)

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
IAsyncEventSourceRepository.GetByIdAsync<TAggregate>(Guid, Int32, CancellationToken)

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, DateTime)

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

Implements
IEventSourceRepository.GetById<TAggregate>(Guid, Int32)

Extension Methods

ObjectExtensions.DeepClone<T>(T)
AnnotationsExtensions.IsValid(Object)
EventSourceRepositoryExtensions.GetById<TAggregate>(IEventSourceRepository, Guid)
EventSourceRepositoryExtensions.GetByIdAsync<TAggregate>(IAsyncEventSourceRepository, Guid, CancellationToken)
EventSourceRepositoryExtensions.Save(IEventSourceRepository, IEventSourced)
EventSourceRepositoryExtensions.Save(IEventSourceRepository, IEventSourced, IMetadataProvider[])
EventSourceRepositoryExtensions.SaveAsync(IAsyncEventSourceRepository, IEventSourced, CancellationToken)
EventSourceRepositoryExtensions.SaveAsync(IAsyncEventSourceRepository, IEventSourced, CancellationToken, IMetadataProvider[])
EventSourceRepositoryExtensions.Save(IEventSourceRepository, IEvent)
EventSourceRepositoryExtensions.Save(IEventSourceRepository, IEvent, IMetadataProvider[])
EventSourceRepositoryExtensions.SaveAsync(IAsyncEventSourceRepository, IEvent, CancellationToken)
EventSourceRepositoryExtensions.SaveAsync(IAsyncEventSourceRepository, IEvent, CancellationToken, IMetadataProvider[])
Back to top Generated by DocFX