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)); }
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 <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)); }