internal static Task <TResult> ExecuteSingleAsync <TResult>(
     IDbAsyncEnumerable <TResult> query,
     Expression queryRoot,
     CancellationToken cancellationToken)
 {
     return(ObjectQueryProvider.GetAsyncElementFunction <TResult>(queryRoot)(query, cancellationToken));
 }
Esempio n. 2
0
 public void ExecuteSingleAsync_throws_OperationCanceledException_if_task_is_cancelled()
 {
     Assert.Throws <OperationCanceledException>(
         () => ObjectQueryProvider.ExecuteSingleAsync <object>(
             new Mock <IDbAsyncEnumerable <object> >().Object,
             new Mock <Expression>().Object,
             new CancellationToken(canceled: true)).GetAwaiter().GetResult());
 }
 Task <TResult> IDbAsyncQueryProvider.ExecuteAsync <TResult>(
     Expression expression,
     CancellationToken cancellationToken)
 {
     Check.NotNull <Expression>(expression, nameof(expression));
     cancellationToken.ThrowIfCancellationRequested();
     return(ObjectQueryProvider.ExecuteSingleAsync <TResult>((IDbAsyncEnumerable <TResult>) this.CreateQuery <TResult>(expression), expression, cancellationToken));
 }
 Task <object> IDbAsyncQueryProvider.ExecuteAsync(
     Expression expression,
     CancellationToken cancellationToken)
 {
     Check.NotNull <Expression>(expression, nameof(expression));
     cancellationToken.ThrowIfCancellationRequested();
     return(ObjectQueryProvider.ExecuteSingleAsync <object>(IDbAsyncEnumerableExtensions.Cast <object>(this.CreateQuery(expression, expression.Type)), expression, cancellationToken));
 }
 object IQueryProvider.Execute(Expression expression)
 {
     Check.NotNull <Expression>(expression, nameof(expression));
     return(ObjectQueryProvider.ExecuteSingle <object>(Enumerable.Cast <object>(this.CreateQuery(expression, expression.Type)), expression));
 }
 TResult IQueryProvider.Execute <TResult>(Expression expression)
 {
     Check.NotNull <Expression>(expression, nameof(expression));
     return(ObjectQueryProvider.ExecuteSingle <TResult>((IEnumerable <TResult>) this.CreateQuery <TResult>(expression), expression));
 }
 internal static TResult ExecuteSingle <TResult>(IEnumerable <TResult> query, Expression queryRoot)
 {
     return(ObjectQueryProvider.GetElementFunction <TResult>(queryRoot)(query));
 }