You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since ASP.NET Core 3, web api will perform async query if the object action result implement IAsyncQueryable
IAsyncEnumerable. However, async query sometimes may cause serious performence issue.
When we use [EnableQuery] attribute, we can not control the final action result. If we want to perform sync query, it should be performed inner [EnableQuery].
This is a feature request. I think it's better to add a new bool property named Async to EnableQueryAttribute. If the property value is false, [EnableQuery] will perform db query before return the action result to the mvc pipeline.
The text was updated successfully, but these errors were encountered:
I mean, for a typical web api, we can use extention method IQueryable.ToList() or IQueryable.ToListAsync() to perform sync/async query.
However, if we directly return IQueryable as the action result, the framework will decide to perform sync or async operation depend on the queryable provider implements IAsyncQueryableIAsyncEnumerable<T> or not. This is what we can not control.
For the same reason, we can not control whether to perform sync or async query when we use OData Web Api, unless we don't use [EnableQuery] or write another action filter.
anranruye
changed the title
Allow sync query in [EnableQuery] attribute
Feature request: Allow sync query in [EnableQuery] attribute
Jan 21, 2021
@anranruye I misunderstood your question. Originally I though it could be related to the concurrency enable query problem that was fixed in 7.5.5. For your scenario, it seems it's a feature request. Thanks.
Inspired by dotnet/efcore#23900
Since ASP.NET Core 3, web api will perform async query if the object action result implement
IAsyncQueryableIAsyncEnumerable. However, async query sometimes may cause serious performence issue.
When we use [EnableQuery] attribute, we can not control the final action result. If we want to perform sync query, it should be performed inner [EnableQuery].
This is a feature request. I think it's better to add a new bool property named
Async
toEnableQueryAttribute
. If the property value is false, [EnableQuery] will perform db query before return the action result to the mvc pipeline.The text was updated successfully, but these errors were encountered: