Example #1
0
        public async Task StoreAsync(AggregateBase aggregate)
        {
            // Take non-persisted events and write them to the event store
            var events = aggregate.GetUncommittedEvents().ToArray();
            await store.AppendStreamAsync(aggregate.Id, aggregate.Version, events)
            .ConfigureAwait(false);

            // Once succesfully persisted, clear events from list of uncommitted events
            aggregate.ClearUncommittedEvents();
        }
Example #2
0
        public void Store(AggregateBase aggregate)
        {
            // Take non-persisted events and write them to the event store
            var events = aggregate.GetUncommittedEvents().ToArray();

            store.AppendStream(aggregate.Id, aggregate.Version, events);

            // Once succesfully persisted, clear events from list of uncommitted events
            aggregate.ClearUncommittedEvents();
        }