Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using System.Collections.Generic;
11 : using Cqrs.Domain;
12 : using Cqrs.Domain.Exceptions;
13 : using Cqrs.Events;
14 :
15 : namespace Cqrs.Akka.Domain
16 : {
17 : /// <summary>
18 : /// A <see cref="SagaRepository{TAuthenticationToken}"/> that is safe to use within Akka.NET
19 : /// </summary>
20 : /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of authentication token.</typeparam>
21 : public interface IAkkaSagaRepository<TAuthenticationToken> : ISagaRepository<TAuthenticationToken>
22 : {
23 : /// <summary>
24 : /// If <paramref name="events"/> is null, loads the events from an <see cref="IEventStore{TAuthenticationToken}"/>, checks for duplicates and then
25 : /// rehydrates the <paramref name="saga"/> with the events.
26 : /// </summary>
27 : /// <typeparam name="TSaga">The <see cref="Type"/> of <see cref="ISaga{TAuthenticationToken}"/>.</typeparam>
28 : /// <param name="saga">The <typeparamref name="TSaga"/> to rehydrate.</param>
29 : /// <param name="events">
30 : /// A collection of <see cref="IEvent{TAuthenticationToken}"/> to replay on the retrieved <see cref="ISaga{TAuthenticationToken}"/>.
31 : /// If null, the <see cref="IEventStore{TAuthenticationToken}"/> will be used to retrieve a list of <see cref="IEvent{TAuthenticationToken}"/> for you.
32 : /// </param>
33 : /// <param name="throwExceptionOnNoEvents">If true will throw an instance of <see cref="SagaNotFoundException{TSaga,TAuthenticationToken}"/> if no aggregate events or provided or found in the <see cref="IEventStore{TAuthenticationToken}"/>.</param>
34 1 : void LoadSagaHistory<TSaga>(TSaga saga, IList<ISagaEvent<TAuthenticationToken>> events = null, bool throwExceptionOnNoEvents = true)
35 : where TSaga : ISaga<TAuthenticationToken>;
36 : }
37 : }
|