@@ -19,7 +19,7 @@ namespace Xtensive.Orm
1919 /// initial query result.
2020 /// </summary>
2121 /// <typeparam name="TElement">The type of the queried elements.</typeparam>
22- public readonly struct PrefetchQuery < TElement > : IEnumerable < TElement >
22+ public readonly struct PrefetchQuery < TElement > : IEnumerable < TElement > , IAsyncEnumerable < TElement >
2323 {
2424 private readonly Session session ;
2525 private readonly IEnumerable < TElement > source ;
@@ -38,9 +38,14 @@ internal PrefetchQuery<TElement> RegisterPath<TValue>(Expression<Func<TElement,
3838 public IEnumerator < TElement > GetEnumerator ( ) =>
3939 new PrefetchQueryEnumerable < TElement > ( session , source , nodes ) . GetEnumerator ( ) ;
4040
41+ /// <inheritdoc />
42+ public IAsyncEnumerator < TElement > GetAsyncEnumerator ( CancellationToken token = default ) =>
43+ new PrefetchQueryAsyncEnumerable < TElement > ( session , source , nodes ) . GetAsyncEnumerator ( token ) ;
44+
4145 /// <summary>
4246 /// Transforms <see cref="PrefetchQuery{TElement}"/> to an <see cref="IAsyncEnumerable{T}"/> sequence.
4347 /// </summary>
48+ [ Obsolete ( "PrefetchQuery itself is an IAsyncEnumerable implementation" ) ]
4449 public IAsyncEnumerable < TElement > AsAsyncEnumerable ( ) =>
4550 new PrefetchQueryAsyncEnumerable < TElement > ( session , source , nodes ) ;
4651
@@ -68,8 +73,7 @@ public ExecuteAsyncResult(List<TElement> items, StrongReferenceContainer referen
6873 /// <para>
6974 /// This method internally puts all elements of the resulting sequence to a list
7075 /// and then it wraps mentioned list as a <see cref="QueryResult{TItem}"/>.
71- /// As a consequence it is more efficient to use asynchronous enumeration over result of
72- /// <see cref="AsAsyncEnumerable"/> method call because it can perform lazily
76+ /// As a consequence it is more efficient to use asynchronous enumeration because it can perform lazily
7377 /// not putting everything into intermediate list.
7478 /// </para>
7579 /// <para> Multiple active operations are not supported. Use <see langword="await"/>
0 commit comments