I have the following code, and it seems the elapsed milliseconds are inaccurate:
public async Task<ActionResult> Index() { try { var connString = RoleEnvironment.IsEmulated ? ConfigurationManager.ConnectionStrings["Poc"].ConnectionString : ConfigurationManager.ConnectionStrings["PocVm"].ConnectionString; var repository = new AccountRepository(connString); var stopWatch = new Stopwatch(); stopWatch.Start(); var accounts = await repository.GetAll(); stopWatch.Stop(); ViewBag.Accounts = accounts; ViewBag.VmStatus = stopWatch.ElapsedMilliseconds; } catch (Exception e) { blah blah blah... } return View(); }
Is this right, or am I missing something painfully obvious?
Mike w
source share