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 :
11 : namespace Cqrs.Domain
12 : {
13 : /// <summary>
14 : /// This is a Unit of Work for sagas
15 : /// </summary>
16 : public interface ISagaUnitOfWork<TAuthenticationToken>
17 : {
18 : /// <summary>
19 : /// Add an item into the <see cref="ISagaUnitOfWork{TAuthenticationToken}"/> ready to be committed.
20 : /// </summary>
21 1 : void Add<TSaga>(TSaga saga)
22 : where TSaga : ISaga<TAuthenticationToken>;
23 :
24 : /// <summary>
25 : /// Get an item from the <see cref="ISagaUnitOfWork{TAuthenticationToken}"/> if it has already been loaded.
26 : /// </summary>
27 1 : TSaga Get<TSaga>(Guid id, int? expectedVersion = null)
28 : where TSaga : ISaga<TAuthenticationToken>;
29 :
30 : /// <summary>
31 : /// Commit any changed <see cref="Saga{TAuthenticationToken}"/> added to this <see cref="ISagaUnitOfWork{TAuthenticationToken}"/> via <see cref="Add{T}"/>
32 : /// </summary>
33 1 : void Commit();
34 : }
35 : }
|