/// <summary> /// Persists the state of the specified aggregate by adding new events to the event store. /// </summary> /// <param name="aggregate">The aggregate to persist.</param> public async Task SaveAsync <TAggregate>(TAggregate aggregate) where TAggregate : class, IEventSourced { aggregates.Add(aggregate); await builder.GetRepository <TAggregate>().Save(aggregate); }
/// <summary> /// Persists the state of the specified aggregate by adding new events to the event store. /// </summary> /// <param name="aggregate">The aggregate to persist.</param> public void Save <TAggregate>(TAggregate aggregate) where TAggregate : class, IEventSourced { aggregates.Add(aggregate); builder.GetRepository(aggregate.GetType()).Save(aggregate); }
public async Task SaveAndMigrateAsync <TAggregate>(TAggregate aggregate, IEnumerable <EventMigrator.Rename> renames) where TAggregate : EventSourcedAggregate <TAggregate> { aggregates.Add(aggregate); await EventMigrator.SaveWithRenames((IMigratableEventSourcedRepository <TAggregate>) builder.GetRepository <TAggregate>(), aggregate, renames); }