Making a Web API controller returning a IQueryable list asynchronous

Viewed 8752

I've been trying to make the following controller method asynchronous

public IQueryable<Category> GetCategories()
{
    return _context.Categories;
}

I've added the following to make it asynchronous

public async Task<IQueryable<Category>> GetCategories()
{
    return await _context.Categories;
}

The type System.Data.Entity.DbSet is not awaitable

I'm not sure how to get the db context to return all the entities while maintaining the IQueryable.

How do you make the above method asynchronous? Thanks or the help.

3 Answers
Related