Skip to content

ToDataSourceResultAsync is not actually AsyncΒ #8086

@kendo-bot

Description

@kendo-bot

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions