IAsyncQueryProvider.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Linq.Expressions;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. namespace System.Linq
  8. {
  9. /// <summary>
  10. /// Represents a query provider for asynchronous enumerable sequences.
  11. /// </summary>
  12. public interface IAsyncQueryProvider
  13. {
  14. /// <summary>
  15. /// Creates a new asynchronous enumerable sequence represented by an expression tree.
  16. /// </summary>
  17. /// <typeparam name="TElement">The type of the elements in the sequence.</typeparam>
  18. /// <param name="expression">The expression tree representing the asynchronous enumerable sequence.</param>
  19. /// <returns>Asynchronous enumerable sequence represented by the specified expression tree.</returns>
  20. IAsyncQueryable<TElement> CreateQuery<TElement>(Expression expression);
  21. /// <summary>
  22. /// Executes an expression tree representing a computation over asynchronous enumerable sequences.
  23. /// </summary>
  24. /// <typeparam name="TResult">The type of the result of evaluating the expression tree.</typeparam>
  25. /// <param name="expression">The expression tree to evaluate.</param>
  26. /// <param name="token">Cancellation token used to cancel the evaluation.</param>
  27. /// <returns>Task representing the result of evaluating the specified expression tree.</returns>
  28. ValueTask<TResult> ExecuteAsync<TResult>(Expression expression, CancellationToken token);
  29. }
  30. }