/// <summary> /// Asynchronously builds menu. /// </summary> /// <returns></returns> public Task <IViewComponentResult> InvokeAsync() { MenuViewModelFactory factory = new MenuViewModelFactory(this, LoggerFactory); Stopwatch watch = new Stopwatch(); watch.Start(); MenuViewModel menu = factory.Create(); watch.Stop(); LoggerFactory.CreateLogger <MenuViewComponent>().LogInformation("Time to build menu content by MenuViewModelFactory: " + watch.ElapsedMilliseconds + " ms"); return(Task.FromResult <IViewComponentResult>(View(menu))); }
/// <summary> /// Asynchronously builds menu. /// </summary> /// <returns>IViewComponentResult object.</returns> public Task <IViewComponentResult> InvokeAsync() { MenuViewModelFactory factory = new MenuViewModelFactory(Storage, LoggerFactory); #if DEBUG Stopwatch watch = new Stopwatch(); watch.Start(); #endif MenuViewModel menu = factory.Create(); #if DEBUG watch.Stop(); _logger.LogInformation("Time to build menu content by MenuViewModelFactory: " + watch.ElapsedMilliseconds + " ms"); #endif return(Task.FromResult <IViewComponentResult>(View(menu))); }