Ejemplo 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)));
        }
Ejemplo n.º 2
0
 public MessageService(GreetingOptions options)
 {
     _options = options;
 }
Ejemplo n.º 3
0
 public static IApplicationBuilder UseGreetingMiddleware(this IApplicationBuilder app, GreetingOptions options)
 {
     return(app.UseMiddleware <GreetingMiddleware>(options));
 }
Ejemplo n.º 4
0
 public static IServiceCollection AddMessageService(this IServiceCollection services, GreetingOptions options)
 {
     return(services.AddScoped <IMessageService>(factory => new MessageService(options)));
 }
Ejemplo n.º 5
0
 public GreetingMiddleware(RequestDelegate next, GreetingOptions options)
 {
     _next    = next;
     _options = options;
 }