Ejemplo n.º 1
0
        /// <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)));
        }
Ejemplo n.º 2
0
        /// <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)));
        }