private void MakeASnapshot(Guid id) { var aggregate = FindById(id); var snapshot = aggregate.Snapshot(); _eventStore.AddSnapshot(StreamNameFor(aggregate.Id), snapshot); }
public async Task Add(TAggregate aggregate) { var streamName = StreamNameFor(aggregate.Id); _eventStore.CreateNewStream(streamName, aggregate.GetUncommittedEvents()); _eventStore.AddSnapshot <TAggregate>(streamName, aggregate); aggregate.MarkEventsAsCommitted(); }
/// <summary> /// Saves the snapshot. /// </summary> /// <param name="snapshot">The snapshot.</param> /// <param name="order">The order.</param> public void SaveSnapshot(OrderSnapshot snapshot, Order order) { var previousSnapshot = GetLatestSnapshot(order.Id); if (previousSnapshot == null || previousSnapshot.Version < snapshot.Version) { _eventStore.AddSnapshot(StreamNameFor(order.Id), snapshot); } }
/// <summary> /// Saves the snapshot. /// </summary> /// <param name="snapshot">The snapshot.</param> /// <param name="cart">The cart.</param> public void SaveSnapshot(CartSnapshot snapshot, Cart cart) { var previousSnapshot = GetLatestSnapshot(cart.Id); if (previousSnapshot == null || previousSnapshot.Version < snapshot.Version) { _eventStore.AddSnapshot(StreamNameFor(cart.Id), snapshot); } }
public void SaveSnapshot(TSnapshot snapshot, TEntity entity) { var previousSnapshot = GetLatestSnapshot(entity.Id); if (previousSnapshot == null || previousSnapshot.Version < snapshot.Version) { _eventStore.AddSnapshot(StreamNameFor(entity.Id), snapshot); } }
public void SaveSnapshot(BankAccountSnapshot snapshot, BankAccount bankAccount) { var streamName = StreamFor(bankAccount.Id); _eventStore.AddSnapshot(streamName, snapshot); }
public void SaveSnapshot(PayAsYouGoAccountSnapshot snapshot, PayAsYouGoAccount payAsYouGoAccount) { var streamName = StreamNameFor(payAsYouGoAccount.Id); _eventStore.AddSnapshot <PayAsYouGoAccountSnapshot>(streamName, snapshot); }