IAsyncQueryProvider.cs 1.5 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
  2. using System.Linq.Expressions;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. namespace System.Linq
  6. {
  7. /// <summary>
  8. /// Represents a query provider for asynchronous enumerable sequences.
  9. /// </summary>
  10. public interface IAsyncQueryProvider
  11. {
  12. /// <summary>
  13. /// Creates a new asynchronous enumerable sequence represented by an expression tree.
  14. /// </summary>
  15. /// <typeparam name="TElement">The type of the elements in the sequence.</typeparam>
  16. /// <param name="expression">The expression tree representing the asynchronous enumerable sequence.</param>
  17. /// <returns>Asynchronous enumerable sequence represented by the specified expression tree.</returns>
  18. IAsyncQueryable<TElement> CreateQuery<TElement>(Expression expression);
  19. /// <summary>
  20. /// Executes an expression tree representing a computation over asynchronous enumerable sequences.
  21. /// </summary>
  22. /// <typeparam name="TResult">The type of the result of evaluating the expression tree.</typeparam>
  23. /// <param name="expression">The expression tree to evaluate.</param>
  24. /// <param name="token">Cancellation token used to cancel the evaluation.</param>
  25. /// <returns>Task representing the result of evaluating the specified expression tree.</returns>
  26. Task<TResult> ExecuteAsync<TResult>(Expression expression, CancellationToken token);
  27. }
  28. }