0

I have controller with actions like below:

public async Task<IHttpActionResult> GetData()
{
    var resultSet = await Task.Run(()=>{Repository.GetRecords();});
    if(resultSet==null)
    {
        return ErrorResponse(){Message = Repository.LastErrorMessage};
    }
    return Ok(resultSet);
}

Repository.GetData is using ODBC driver for getting data from Database. Is this pattern ok for WEB.API Action or it will harm the performance by creating separate Task for getting Data?

Samvel Petrosov
  • 7,580
  • 2
  • 22
  • 46

0 Answers0