private static void ApplyGlobalAfterHook(IApplicationBuilder builder, CarterOptions options, ILogger logger)
 {
     if (options?.After != null)
     {
         builder.Use(async(ctx, next) =>
         {
             await next();
             logger.LogDebug("Executing global after hook");
             await options.After(ctx);
         });
     }
 }
Exemple #2
0
 private static void ApplyGlobalAfterHook(IApplicationBuilder builder, CarterOptions options)
 {
     if (options?.After != null)
     {
         builder.Use(async(ctx, next) =>
         {
             var loggerFactory = ctx.RequestServices.GetService <ILoggerFactory>();
             var logger        = loggerFactory.CreateLogger("Carter.GlobalAfterHook");
             await next();
             logger.LogDebug("Executing global after hook");
             await options.After(ctx);
         });
     }
 }