Open Forevka opened 1 week ago
Duplicate of:
@Forevka Are you able to achieve the async calls using:
[HttpGet]
[EnableQuery]
public IAsyncEnumerable<Customer> Get()
{
return this.context.Customers.AsAsyncEnumerable();
}
as suggested here https://github.com/OData/WebApi/issues/2598
@WanjohiSammy I'm pretty sure the moment you call AsAsyncEnumerable
, anything else called on top of it (all the modifiers applied by EnableQuery
) will be executed in memory, and not in the database, as it leaves the queryable realm.
So that is definitely not a good solution. It would only be usable if you injected ODataQueryOptions<T>
and applied it yourself before calling AsAsyncEnumerable
.
Assemblies affected ASP.NET Core OData 8.x and ASP.NET Core OData 9.x
Describe the bug All database calls that are made in order to fetch data from IQueryable<> that returned from controller route are made synchronous
Reproduce steps
Data Model Sample model (but it's don't really matter)
Expected behavior I don't really know on which side the problem is, but: I expect that if my database connector and linq provider implements Async versions, EnableQuery attribute will use this overloads.
Screenshots How it's now:
As you see on screenshot, database calls made synchronous
Additional context Workaround was created in case anybody need it, but I hope it will be fixed inside library
How to use:
result: all calls are made async