示例#1
0
        public async Task <bool> ShouldMakeSnapShot(IAggregateRoot aggregate)
        {
            var lastSnapshotVersion = await _snapshotStore.GetVersion(aggregate.Id);

            if (!lastSnapshotVersion.HasValue)
            {
                return(true);
            }

            var newEvents = aggregate.Version - lastSnapshotVersion;

            return(newEvents >= _eventsBeforeSnapshot);
        }