public IActionResult Index() { ViewBag.ServiceA = _serviceA.Run(); ViewBag.ServiceB = _serviceB.Run(); ViewBag.ServiceC = _serviceC.Run(); return(View()); }
protected override void OnStarted() { _logger.LogInformation("OnStarted has been called. {id}", System.Threading.Thread.CurrentThread.ManagedThreadId); using (var scope = _services.CreateScope()) { IServiceA serviceA = scope.ServiceProvider.GetRequiredService <IServiceA>(); serviceA.Run(); } }
public IActionResult Index2() { IServiceA serviceA = DependencyResolver.Current.GetService <IServiceA>(); IServiceB serviceB = DependencyResolver.Current.GetService <IServiceB>(); IServiceC serviceC = DependencyResolver.Current.GetService <IServiceC>(); ViewBag.ServiceA = serviceA.Run(); ViewBag.ServiceB = serviceB.Run(); ViewBag.ServiceC = serviceC.Run(); return(View("Index")); }
public IActionResult Index() { InputDTO inputA = new InputDTO(); inputA.str = "ServiceA"; ViewBag.ServiceA = _serviceA.Run(inputA); InputDTO inputB = new InputDTO(); inputB.str = "ServiceB"; ViewBag.ServiceB = _serviceB.Run(inputB); InputDTO inputC = new InputDTO(); inputC.str = "ServiceC"; ViewBag.ServiceC = _serviceC.Run(inputC); return(View()); }
public void Run() { _serviceA.Run(); }