public static IServiceCollection AddConventionBasedInMemoryCommandBus( this IServiceCollection services, EventSourceConfiguration config) { services.AddSingleton <EventSourceConfiguration>(config); services.AddSingleton <ICommandBus>(x => InMemoryCommandBus.CreateConventionCommandBus( x.GetRequiredService <IDomainObjectRepository>(), x.GetRequiredService <ILoggerFactory>(), x.GetRequiredService <EventSourceConfiguration>())); return(services); }
public static EventSourceConfiguration SetConventionBasedInMemoryCommandBus(this EventSourceConfiguration config) { Precondition.For(() => config).NotNull(); Precondition.For(() => config.DomainObjectRepository).NotNull(); Precondition.For(() => config.DomainObjectAssemblies).NotNull(); config.CommandBus = InMemoryCommandBus.CreateConventionCommandBus(config.DomainObjectRepository, config.DomainObjectAssemblies); return(config); }