public async Task <bool> ShouldTakeSnapshot(IAggregateRoot aggregate) { if (!(aggregate is ISnapshotable)) { return(false); } var config = snapshotConfiguration.GetConfiguration(aggregate); if (config == null) { return(false); } var storedSnapshotVersion = await snapshotStore.ReadVersion(aggregate.Metadata.AggregateId); return(aggregate.Metadata.Version - storedSnapshotVersion >= config.TakeSnapshotWhenVersionDiferrenceIsBiggerThanOrEqual); }