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.Events;
13 :
14 : namespace Cqrs.Snapshots
15 : {
16 : /// <summary>
17 : /// Provides information about the ability to make and get <see cref="Snapshot">snapshots</see>.
18 : /// </summary>
19 : /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
20 : public interface ISnapshotStrategy<TAuthenticationToken>
21 : {
22 : /// <summary>
23 : /// Indicates if the provided <paramref name="aggregate"/> should have a <see cref="Snapshot"/> made.
24 : /// This does NOT indicate if the provided <paramref name="aggregate"/> can have a <see cref="Snapshot"/> made or not.
25 : /// </summary>
26 : /// <param name="aggregate">The <see cref="IAggregateRoot{TAuthenticationToken}"/> to check.</param>
27 : /// <param name="uncommittedChanges">A collection of uncommited changes to assess. If null the aggregate will be asked to provide them.</param>
28 1 : bool ShouldMakeSnapShot(IAggregateRoot<TAuthenticationToken> aggregate, IEnumerable<IEvent<TAuthenticationToken>> uncommittedChanges = null);
29 :
30 : /// <summary>
31 : /// Indicates if the provided <paramref name="aggregateType"/> can have a <see cref="Snapshot"/> made or not.
32 : /// </summary>
33 : /// <param name="aggregateType">The <see cref="Type"/> of <see cref="IAggregateRoot{TAuthenticationToken}"/> to check.</param>
34 1 : bool IsSnapshotable(Type aggregateType);
35 : }
36 : }
|