public ActionResult Index() { string currentUser = User.Identity.Name; var result = fixItRepository.FindOpenTasksByOwner(currentUser); return View(result); }
public async Task<ActionResult> Index() { string currentUser = User.Identity.Name; var result = await fixItRepository.FindOpenTasksByOwnerAsync(currentUser); return View(result); }
FindTaskByIdAsync
, ASP.NET makes the FindTask
request and then unwinds the worker thread and makes it available to process another request. When the FindTask
request is done, a thread is restarted to continue processing the code that comes after that call. During the interim between when the FindTask
request is initiated and when the data is returned, you have a thread available to do useful work which otherwise would be tied up waiting for the response.
Add comment