Пример #1
0
        public async Task TakeSnapshotSync(IAggregateRoot aggregate)
        {
            if (!(aggregate is ISnapshotable))
            {
                return;
            }

            var takeSnapshotMethod = aggregate.GetType().GetMethod("TakeSnapshot");
            var memento            = (Memento)takeSnapshotMethod.Invoke(aggregate, new object[] { });

            await snapshotStore.Write(memento);
        }