I have created stored procedure that create some report. Standard Id, UserName, NumOfSomething, Month.
Now I would like to get result of this stored procedure async. I can do it with standard sync way:
public async ValueTask<List<ReportDto>> GetReport(int managerId)
{
var result = reportContext.Database.SqlQuery<ReportDto>($"MonthlyNumOfCasesPerUserReport @ManagerId = {managerId}").ToList();
return result;
}
This code works quite good as it already map result into my entities but I would like to do it async.
I have already tried ToListAsync() but I get error:
System.InvalidOperationException: The source IQueryable doesn’t
implement IDbAsyncEnumerable<CommonLibrary.Dto.ReportDto>. Only
sources that implement IDbAsyncEnumerable can be used for Entity
Framework asynchronous operations.
1