❔ [.NET 6][Odata 8] IQueryable Async
Hello,
I am currently trying to implement an OData Web API.
OData works incredibly well with IQueryable as it applies the ODataQueryOptions directly to the database call.
I am trying to figure out, if it is possible to make the controller action async.
What I already have implemented:
[EnableQuery]
[HttpGet("Users")]
public IActionResult GetUsers([FromServices] UsersDbContext usersContext)
{
return new OkObjectResult(usersContext.Users);
}
What I am trying to achieve:
[EnableQuery]
[HttpGet("Users")]
public async Task<IActionResult> GetUsers([FromServices] UsersDbContext usersContext)
{
return new OkObjectResult(await usersContext.Users); <--- something async
}
2 Replies