This repository was archived by the owner on Feb 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Source/LinqToDB.EntityFrameworkCore/Internal Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 44using System . Linq ;
55using System . Linq . Expressions ;
66using System . Reflection ;
7+ using System . Runtime . CompilerServices ;
78using System . Threading ;
89using System . Threading . Tasks ;
910
@@ -158,8 +159,17 @@ IEnumerator IEnumerable.GetEnumerator()
158159 /// <returns>Query result as <see cref="IAsyncEnumerable{T}"/>.</returns>
159160 public IAsyncEnumerator < T > GetAsyncEnumerator ( CancellationToken cancellationToken )
160161 {
161- return Task . Run ( ( ) => QueryProvider . ExecuteAsyncEnumerable < T > ( Expression , cancellationToken ) ,
162- cancellationToken ) . Result . GetAsyncEnumerator ( cancellationToken ) ;
162+ async IAsyncEnumerable < T > EnumerateAsyncEnumerable ( [ EnumeratorCancellation ] CancellationToken ct )
163+ {
164+ var asyncEnumerable = await QueryProvider . ExecuteAsyncEnumerable < T > ( Expression , ct )
165+ . ConfigureAwait ( false ) ;
166+ await foreach ( var item in asyncEnumerable . WithCancellation ( ct ) )
167+ {
168+ yield return item ;
169+ }
170+ }
171+
172+ return EnumerateAsyncEnumerable ( cancellationToken ) . GetAsyncEnumerator ( cancellationToken ) ;
163173 }
164174
165175 /// <summary>
You can’t perform that action at this time.
0 commit comments