private async Task <IOperationResult> ExecuteOperationAsync( IOperation operation, CancellationToken cancellationToken) { var context = new HttpOperationContext( operation, _clientFactory(), _services, cancellationToken); try { await _executeOperation(context).ConfigureAwait(false); if (context.Result is null) { // todo : resources throw new InvalidOperationException(); } return(context.Result); } finally { if (context.HttpResponse != null) { context.HttpResponse.Dispose(); } if (context.HttpRequest != null) { context.HttpRequest.Dispose(); } } }
private async Task ExecuteOperationAsync( IOperation operation, IOperationResultBuilder resultBuilder, CancellationToken cancellationToken) { var context = new HttpOperationContext( operation, _operationFormatter, resultBuilder, _resultParserResolver.Get(operation.ResultType), _clientFactory(), cancellationToken); try { await _executeOperation(context).ConfigureAwait(false); } finally { if (context.HttpResponse != null) { context.HttpResponse.Dispose(); } if (context.HttpRequest != null) { context.HttpRequest.Dispose(); } } }
private async Task <IOperationResult> ExecuteOperationAsync( IOperation operation, CancellationToken cancellationToken) { var context = new HttpOperationContext( operation, _client, _services, cancellationToken); try { await _executeOperation(context).ConfigureAwait(false); return(context.Result); } finally { if (context.HttpResponse != null) { context.HttpResponse.Dispose(); } if (context.HttpRequest != null) { context.HttpRequest.Dispose(); } } }