4 ms·
But EFCore doesnt support async enumerables does it?
by aliswe 4y ago
But EFCore doesnt support async enumerables does it?
- WorldMaker 4y agoIt's not very well documented, but EF Core has supported IAsyncEnumerable<T> since EF Core 3.0 or thereabouts. Just about any of its IQueryable<T> LINQ implementations are castable to IAsyncEnumerable<T>, easiest through .AsAsyncEnumerable() and generally just work when you do that. Most people just use the .ToListAsync() and .ToArrayAsync() "materialization" tools which I believe use IAsyncEnumerable<T> under the hood, but you can use IAsyncEnumerable<T> directly if you want. Generally though, EF Core's support for IAsyncEnumerable<T> is mostly known for the confusion it causes with "Ix" (Interactive Extensions; the System.Interactive.Async nuget package that adds a bunch of LINQ extensions for IAsyncEnumerable<T> to the `using System.Linq.Async;` namespace) because if you install that package and have such using statements there's overload conflicts between IQueryable<T> and IAsyncEnumerable<T> for many LINQ operators and you have to explicitly add .AsQueryable() to almost all of your EF Core LINQ to make sure to avoid those operator conflicts and force a cast to just IQueryable<T>, not both IQueryable<T> and IAsyncEnumerable<T>.