I have a method which calls database as shown below:
BL Method to call DAO method:
public async Task<List<Classes>> GetClassesAndAddRules(string classId) { var classData = await Task.Run( () => _daoClass.GetClasses(classId)); //logic for adding rule //.................................. } DatabaseCall in DAO:
//*below method takes 1 second approx to return* public List<Classes> GetClasses(string id) { var retVal = new List<Classes>(); using (var context = new test_db_context()) { var rows = context.GetClassesById(id); foreach (ClassesDBComplexType row in rows) { retVal.Add(Mapper.Map<GetClassesByClassIdOut>(row)); } } return retVal; } Is there any performance boost just my calling the DAO method using await ?
My understanding is GetClasses() will be called on a separate thread so that it doesn't block and continue processing other stuff.
Any help is appreciated.