public static BoundedContextModelBuilder WithSqlServerEventStore(this BoundedContextModelBuilder model, string connectionString) { model.Services(cfg => { cfg.AddScoped <IEventStore>((svcs) => new SqlServer.SqlServerEventStore(connectionString)); }); return(model); }
public static BoundedContextModelBuilder WithAzureServiceBus(this BoundedContextModelBuilder model, string connectionString) { model.Services(cfg => { Func <IServiceProvider, Azure.AzureServiceBus> factory = (svcs) => { //TODO: endpoint name return(new Azure.AzureServiceBus(connectionString, String.Empty, svcs.GetRequiredService <ISerialization>(), svcs.GetRequiredService <RouteTable>())); }; cfg.AddScoped <ICommandBus>(factory); cfg.AddScoped <IEventBus>(factory); }); return(model); }