private void CreateSnapshots(StreamHead[] streams) { //TODO: Create IMementos to store in snapshot. Not sure how to do that ATM. if (streams.Length == 0) { return; } foreach (StreamHead head in streams) { IEventStream eventStream = eventStore.OpenStream(head.StreamId, head.HeadRevision, int.MaxValue); EventMessage message = eventStream.CommittedEvents.Last(); if (message == null) { continue; } var snapshot = new Snapshot(head.StreamId, head.SnapshotRevision + 1, message); eventStore.AddSnapshot(snapshot); observer.Notify(new SnapshotTaken(head.StreamId, head.HeadRevision)); } }
private static void TakeSnapshot() { var memento = new AggregateMemento { Value = "snapshot" }; store.AddSnapshot(new Snapshot(StreamId, 2, memento)); }