public async Task <TResult> ExecuteAsync <TResult>(Expression expression) { var rlinq = RemoteQueryProvider <TSource> .TranslateExpression(expression, _typeInfoProvider, _canBeEvaluatedLocally); var dataRecords = await _dataProvider(rlinq); var result = await _resultMapper.MapResultAsync <TResult>(dataRecords, expression); return(result); }
public async Task <TResult> ExecuteAsync <TResult>(Expression expression, CancellationToken cancellationToken) { var rlinq = RemoteQueryProvider <TSource> .TranslateExpression(expression, _typeInfoProvider, _canBeEvaluatedLocally); var dataRecords = await _asyncDataProvider(rlinq, cancellationToken).ConfigureAwait(false); var result = await _resultMapper.MapResultAsync <TResult>(dataRecords, expression, cancellationToken).ConfigureAwait(false); return(result); }
public async IAsyncEnumerable <TResult> ExecuteAsyncRemoteStream <TResult>(Expression expression, [EnumeratorCancellation] CancellationToken cancellation) { cancellation.ThrowIfCancellationRequested(); var rlinq = RemoteQueryProvider <TSource> .TranslateExpression(expression, _typeInfoProvider, _canBeEvaluatedLocally); cancellation.ThrowIfCancellationRequested(); var asyncEnumerable = _dataProvider(rlinq, cancellation); cancellation.ThrowIfCancellationRequested(); await foreach (var resultItem in asyncEnumerable.WithCancellation(cancellation)) { cancellation.ThrowIfCancellationRequested(); var result = _resultMapper.MapResult <TResult>(resultItem, expression); yield return(result); } }
public TResult Execute <TResult>(Expression expression) { var rlinq = RemoteQueryProvider <TSource> .TranslateExpression(expression, _typeInfoProvider, _canBeEvaluatedLocally); var task = _dataProvider(rlinq); TResult result; try { var dataRecords = task.Result; if (object.Equals(default(TSource), dataRecords)) { result = default(TResult); } else { var mappingTask = _resultMapper.MapResultAsync <TResult>(dataRecords, expression); result = mappingTask.Result; } } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 0) { throw ex.InnerException; } else { throw; } } return(result); }