public static IServiceCollection AddMessageServiceAction(this IServiceCollection services, Action <GreetingOptions> optionsAction) { var options = new GreetingOptions(); optionsAction(options); return(services.AddScoped <IMessageService>(factory => new MessageService(options))); }
public MessageService(GreetingOptions options) { _options = options; }
public static IApplicationBuilder UseGreetingMiddleware(this IApplicationBuilder app, GreetingOptions options) { return(app.UseMiddleware <GreetingMiddleware>(options)); }
public static IServiceCollection AddMessageService(this IServiceCollection services, GreetingOptions options) { return(services.AddScoped <IMessageService>(factory => new MessageService(options))); }
public GreetingMiddleware(RequestDelegate next, GreetingOptions options) { _next = next; _options = options; }