public Task <bool> ShouldCreateSnapshotAsync(
            ISnapshotAggregateRoot snapshotAggregateRoot,
            CancellationToken cancellationToken)
        {
            var currentSnapshotVersion = snapshotAggregateRoot.SnapshotVersion.GetValueOrDefault();
            var shouldCreateSnapshot   = snapshotAggregateRoot.Version - currentSnapshotVersion >= _snapshotAfterVersions;

            return(Task.FromResult(shouldCreateSnapshot));
        }
Exemplo n.º 2
0
 public Task <bool> ShouldCreateSnapshotAsync(
     ISnapshotAggregateRoot snapshotAggregateRoot,
     CancellationToken cancellationToken)
 {
     return(Task.FromResult(Random.NextDouble() >= _chance));
 }
Exemplo n.º 3
0
 public Task <bool> ShouldCreateSnapshotAsync(ISnapshotAggregateRoot snapshotAggregateRoot, CancellationToken cancellationToken)
 {
     return(Task.FromResult(true));
 }