Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToDataSourceResultAsync is not actually Async #8086

Open
kendo-bot opened this issue Jan 3, 2025 · 0 comments
Open

ToDataSourceResultAsync is not actually Async #8086

kendo-bot opened this issue Jan 3, 2025 · 0 comments

Comments

@kendo-bot
Copy link
Collaborator

kendo-bot commented Jan 3, 2025

In the example below, "products" is actually a DbSet<Product>:

public async Task<ActionResult> Products_Read([DataSourceRequest]DataSourceRequest request)
{
    using (var northwind = new SampleEntities())
    {
        IQueryable<Product> products = northwind.Products;
        DataSourceResult result = await products.ToDataSourceResultAsync(request);
        return Json(result);
    }
}

Under the hood the ToDataSourceResultAsync call is executed inside Task.Run().

And that Task.Run is calling sync methods of IQueryable which means EntityframeworkCore queries are not taking place with async I/O

@kendo-bot kendo-bot added the FP: Pending Review Sync status with associated Feedback Item label Jan 3, 2025
@github-actions github-actions bot added the FP: Unplanned Sync status with associated Feedback Item label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants