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)); }
/// <summary> /// Asynchronously enumerates the query results and performs the specified action on each element. /// </summary> /// <remarks> /// Multiple active operations on the same context instance are not supported. Use 'await' to ensure /// that any asynchronous operations have completed before calling another method on this context. /// </remarks> /// <param name="action"> The action to perform on each element. </param> /// <param name="cancellationToken"> /// A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete. /// </param> /// <returns> A task that represents the asynchronous operation. </returns> public virtual Task ForEachAsync(Action <object> action, CancellationToken cancellationToken) { Check.NotNull <Action <object> >(action, nameof(action)); return(IDbAsyncEnumerableExtensions.ForEachAsync(this, action, cancellationToken)); }