Esempio n. 1
0
 public static CommandPipelineHandlerDelegate Next(this IMiddleware commandMiddleware,
                                                   ICliContext cliContext,
                                                   CommandPipelineHandlerDelegate next,
                                                   CancellationToken cancellationToken)
 {
     return(() => commandMiddleware.HandleAsync(cliContext, next, cancellationToken));
 }
Esempio n. 2
0
 public Task HandleAsync(IMiddlewareAsyncContext context, CancellationToken cancellationToken)
 {
     if (_IsCompatible <TAction>(context.Action))
     {
         return(_middleware.HandleAsync(new MiddlewareAsyncContextAdapter <TAction>(context), cancellationToken));
     }
     else
     {
         return(context.NextAsync(cancellationToken));
     }
 }
Esempio n. 3
0
        public static CommandPipelineHandlerDelegate Next(this IMiddleware commandMiddleware,
                                                          ICliContext cliContext,
                                                          CommandPipelineHandlerDelegate next,
                                                          Type middlewareType,
                                                          ILogger logger,
                                                          CancellationToken cancellationToken)
        {
            return(() =>
            {
                logger.LogDebug("Executing middleware {MiddlewareType}", middlewareType.FullName);

                return new ValueTask(commandMiddleware.HandleAsync(cliContext, next, cancellationToken));
            });
        }