Here is my ODATA controller with an ODATA action.
public class MyController : ODataController
{
private readonly Repository_repo;
public MyController(IRepository repo)
{
_repo = repo;
}
[EnableQuery(PageSize = 10, EnsureStableOrdering = false)]
public IActionResult Get()
{
var data = _repo.GetData();
return Ok(data)
}
}
Here is my Repository method.
public IQueryable<DataModel> GetData() => _db.DbSet.Select(data=> new DataModel
{
// Implement model
}).
Now I understand there is no point making the GetData method in the repo as async because that is just returning a queryable which doesn't get executed till you call it's enumerator.
So the part to make async is the action method. How would I make this an async await- able call? Odata EnableQuery method expects an IQueryable as far as I am aware.