public static IServiceCollection AddImGalaxyESEventStoreModule(this IServiceCollection services, Action <IEventStoreConfigurations> configurations) => services.With(s => { var configs = new EventStoreConfigurations().With(c => configurations(c)); s.RegisterConfigurations(configs) .RegisterProviders() .RegisterChangeTracker() .RegisterEventStore() .RegisterAggregateStore() .RegisterRepositories() .RegisterSnapshotableRepositories(configs) .RegisterUnitOfWork(); });
private static IServiceCollection RegisterConfigurations(this IServiceCollection services, EventStoreConfigurations configurations) => services.AddSingleton <IEventStoreConfigurations>(provider => configurations);