public virtual Task <Response <TResponse> > ExecuteAsync <TResponse>( IRequest <TResponse> request, System.Threading.CancellationToken cancellationToken) { var executionContext = new RequestHandlerExecutionContext(); return(this.ExecuteAsync(request, cancellationToken, executionContext)); }
public virtual async Task <Response <TResponse> > ExecuteAsync <TResponse>( IRequest <TResponse> request, System.Threading.CancellationToken cancellationToken, IRequestHandlerExecutionContext executionContext) { if (request is null) { throw new ArgumentNullException(nameof(request)); } if (executionContext is null) { executionContext = new RequestHandlerExecutionContext(); } var solver = this.GetSolver(); var handler = solver.GetRequestHandler <TResponse>(request, executionContext); var task = handler.ExecuteTypedAsync(request, cancellationToken, executionContext); var result = await task.ConfigureAwait(false); return(result); }