public static ServiceComponentsHostBuilder AddOpenApi(this ServiceComponentsHostBuilder builder, Action <IConfiguration, SwaggerGenOptions> generatorOptions, Action <IConfiguration, SwaggerUIOptions> uiOptions) { builder.RegisterCallback((configuration, services) => { services.AddSwaggerGen(c => { generatorOptions(configuration, c); }); }); builder.RegisterCallback((configuration, environment, app) => { app.UseSwagger(); app.UseSwaggerUI(c => uiOptions(configuration, c)); }); return(builder); }
public static ServiceComponentsHostBuilder AddPrometheusMetrics(this ServiceComponentsHostBuilder hostBuilder) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddPrometheusRequestMetricsService(); containerBuilder.AddPrometheusRequestMetricsBehavior(); })); }
public static ServiceComponentsHostBuilder AddRedisDistributedCache(this ServiceComponentsHostBuilder hostBuilder, string connection, string instance = default) { return(hostBuilder.RegisterCallback((configuration, services) => services.AddStackExchangeRedisCache(options => { options.InstanceName = instance; options.Configuration = connection; }))); }
public static ServiceComponentsHostBuilder AddHealthCheck( this ServiceComponentsHostBuilder hostBuilder, Action <IConfiguration, IHealthChecksBuilder> builder, string readinessPath = "/.well-known/ready", string livenessPath = "/.well-known/live") { return(hostBuilder .RegisterCallback((configuration, environment, app) => { app.UseHealthChecks(readinessPath, new HealthCheckOptions { Predicate = registration => registration.Tags == null || !registration.Tags.Any() || registration.Tags.Contains(ReadinessTag) }); app.UseHealthChecks(livenessPath, new HealthCheckOptions { Predicate = registration => registration.Tags == null || !registration.Tags.Any() || registration.Tags.Contains(LivenessTag) }); }) .RegisterCallback((configuration, services) => { builder(configuration, services.AddHealthChecks() .AddCheck("self", () => HealthCheckResult.Healthy(), new[] { LivenessTag })); })); }
public static ServiceComponentsHostBuilder AddLoopbackSender(this ServiceComponentsHostBuilder hostBuilder, object key = default) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddLoopbackCommandSender(key); containerBuilder.AddLoopbackQuerySender(key); containerBuilder.AddLoopbackEventPublisher(key); })); }
public static ServiceComponentsHostBuilder AddHttpSender(this ServiceComponentsHostBuilder hostBuilder, Uri endpointUri, object key = default) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddHttpCommandSender(endpointUri, key); containerBuilder.AddHttpQuerySender(endpointUri, key); containerBuilder.AddHttpEventPublisher(endpointUri, key); })); }
public static ServiceComponentsHostBuilder AddRedisDistributedCache(this ServiceComponentsHostBuilder hostBuilder, Action <ConfigurationOptions> optionsBuilder) { var opts = new ConfigurationOptions(); optionsBuilder(opts); return(hostBuilder.RegisterCallback((configuration, services) => services.AddStackExchangeRedisCache(options => { options.ConfigurationOptions = opts; }))); }
public static ServiceComponentsHostBuilder AddRedis(this ServiceComponentsHostBuilder hostBuilder, Func <IConfiguration, string> connectionStringBuilder) { hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddRedisConnection(connectionStringBuilder(context.Configuration)); containerBuilder.AddRedisDatabase(); }); return(hostBuilder); }
public static ServiceComponentsHostBuilder AddHttpSender(this ServiceComponentsHostBuilder hostBuilder, Func <IConfiguration, Uri> endpointUriBuilder, object key = default) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { var uri = endpointUriBuilder(context.Configuration); containerBuilder.AddHttpCommandSender(uri, key); containerBuilder.AddHttpQuerySender(uri, key); containerBuilder.AddHttpEventPublisher(uri, key); })); }
public static ServiceComponentsHostBuilder AddMediator(this ServiceComponentsHostBuilder hostBuilder, Assembly[] applicationAssemblies, bool addBehavior = true) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddMediator(applicationAssemblies); if (addBehavior) { containerBuilder.AddMediatorBehavior(applicationAssemblies); } })); }
public static ServiceComponentsHostBuilder AddBadge(this ServiceComponentsHostBuilder hostBuilder, Action <IConfiguration, IBadgeRegistry> builder, string pattern = ".badge") { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddBadgeService(registry => builder(context.Configuration, registry)); }) .RegisterCallback((configuration, routeBuilder) => { routeBuilder.MapControllerRoute(name: "badge", pattern: $"{pattern.TrimEnd('/')}/{{name?}}", defaults: new { controller = "Badge", action = "Get" }); })); }
public static ServiceComponentsHostBuilder AddCorrelation(this ServiceComponentsHostBuilder hostBuilder) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddCorrelationInfo(); containerBuilder.AddReceiverCorrelationLogEnricherBehavior(); containerBuilder.AddHttpReceiverCorrelationBehavior(); containerBuilder.AddHttpSenderCorrelationBehavior(); containerBuilder.AddLoopbackReceiverCorrelationBehavior(); containerBuilder.AddRabbitReceiverCorrelationBehavior(); containerBuilder.AddRabbitSenderCorrelationBehavior(); })); }
public static ServiceComponentsHostBuilder AddEndpoints(this ServiceComponentsHostBuilder builder) { builder.RegisterCallback((configuration, environment, app) => { app.UseEndpoints(endpoints => { endpoints.MapControllers(); builder.EndpointRouteBuilderCallbacks.ForEach(action => { action(configuration, endpoints); }); }); }); return(builder); }
public static ServiceComponentsHostBuilder AddReceivers(this ServiceComponentsHostBuilder hostBuilder, bool http = true, bool loopback = true) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddReceivers(); if (http) { containerBuilder.AddHttpReceivers(); } if (loopback) { containerBuilder.AddLoopbackReceivers(); } })); }
public static ServiceComponentsHostBuilder AddValidationBehavior(this ServiceComponentsHostBuilder hostBuilder, Assembly[] apiAssemblies) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddValidationBehavior(apiAssemblies); })); }
public static ServiceComponentsHostBuilder ConfigureMvc(this ServiceComponentsHostBuilder hostBuilder, Action <IMvcBuilder> mvcBuilder) { return(hostBuilder.RegisterCallback(mvcBuilder)); }
public static ServiceComponentsHostBuilder AddStopwatchBehavior(this ServiceComponentsHostBuilder hostBuilder) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddStopwatchBehavior(); })); }
public static ServiceComponentsHostBuilder AddNHibernate(this ServiceComponentsHostBuilder hostBuilder, Func <IConfiguration, string> connectionString, Action <MappingConfiguration> mapping, Action <Configuration> exposeConfiguration) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.RegisterModule(new NhibernateModule(connectionString(context.Configuration), mapping, exposeConfiguration)); })); }
public static ServiceComponentsHostBuilder UseAutofac(this ServiceComponentsHostBuilder builder) { builder.RegisterCallback(hostBuilder => hostBuilder.UseServiceProviderFactory(new AutofacServiceProviderFactory())); return(builder); }
public static ServiceComponentsHostBuilder UseSerilog(this ServiceComponentsHostBuilder builder) { builder.RegisterCallback(hostBuilder => hostBuilder.UseSerilog((context, configuration) => configuration.ReadFrom.Configuration(context.Configuration))); return(builder); }
public static ServiceComponentsHostBuilder AddRedisDistributedCache(this ServiceComponentsHostBuilder hostBuilder, string connectionString) { return(hostBuilder.RegisterCallback((configuration, services) => services.AddStackExchangeRedisCache(options => { options.ConfigurationOptions = ConfigurationOptions.Parse(connectionString); }))); }
public static ServiceComponentsHostBuilder UseSerilog(this ServiceComponentsHostBuilder builder, Action <HostBuilderContext, LoggerConfiguration> callback) { builder.RegisterCallback(hostBuilder => hostBuilder.UseSerilog(callback)); return(builder); }
public static ServiceComponentsHostBuilder ConfigureApp(this ServiceComponentsHostBuilder hostBuilder, Action <IConfiguration, IHostEnvironment, IApplicationBuilder> appBuilder) { return(hostBuilder.RegisterCallback(appBuilder)); }
public static ServiceComponentsHostBuilder UseRequestBinder(this ServiceComponentsHostBuilder builder) { builder.RegisterCallback(options => options.UseRequestBinder()); return(builder); }
public static ServiceComponentsHostBuilder ConfigureContainer(this ServiceComponentsHostBuilder hostBuilder, Action <HostBuilderContext, ContainerBuilder> containerBuilder) { return(hostBuilder.RegisterCallback(containerBuilder)); }
public static ServiceComponentsHostBuilder AddEventRouter(this ServiceComponentsHostBuilder hostBuilder, Func <IEvent, object> keySelectorFunc) { return(hostBuilder.RegisterCallback((context, containerBuilder) => { containerBuilder.AddEventRouter(keySelectorFunc); })); }