public static CommandPipelineHandlerDelegate Next(this IMiddleware commandMiddleware, ICliContext cliContext, CommandPipelineHandlerDelegate next, CancellationToken cancellationToken) { return(() => commandMiddleware.HandleAsync(cliContext, next, cancellationToken)); }
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)); } }
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)); }); }