Esempio n. 1
0
        public static IServiceCollection AddMessageServiceAction(this IServiceCollection services, Action <GreetingOptions> optionsAction)
        {
            var options = new GreetingOptions();

            optionsAction(options);
            return(services.AddScoped <IMessageService>(factory => new MessageService(options)));
        }
Esempio n. 2
0
 public MessageService(GreetingOptions options)
 {
     _options = options;
 }
Esempio n. 3
0
 public static IApplicationBuilder UseGreetingMiddleware(this IApplicationBuilder app, GreetingOptions options)
 {
     return(app.UseMiddleware <GreetingMiddleware>(options));
 }
Esempio n. 4
0
 public static IServiceCollection AddMessageService(this IServiceCollection services, GreetingOptions options)
 {
     return(services.AddScoped <IMessageService>(factory => new MessageService(options)));
 }
Esempio n. 5
0
 public GreetingMiddleware(RequestDelegate next, GreetingOptions options)
 {
     _next    = next;
     _options = options;
 }