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?