public IActionResult Get() { var scopedGuid = (HttpContext.RequestServices.GetService(typeof(IScopedService)) as IScopedService).GetGuid(); var transientGuid = (HttpContext.RequestServices.GetService(typeof(ITransientService)) as ITransientService).GetGuid(); var singletonGuid = (HttpContext.RequestServices.GetService(typeof(ISingletonService)) as ISingletonService).GetGuid(); var model = new List <IOCServiceResult>() { new IOCServiceResult("Scoped", _scopedService.GetGuid().ToString(), scopedGuid.ToString()), new IOCServiceResult("Transient", _transientService.GetGuid().ToString(), transientGuid.ToString()), new IOCServiceResult("Singleton", _singletonService.GetGuid().ToString(), singletonGuid.ToString()), }; return(View("~/Views/Index.cshtml", model)); }
public List <string> Transient() { return(new List <string> { _transient1.GetGuid(), _transient2.GetGuid() }); }
public IActionResult Transient() { return(View("Transient", _transientService.GetGuid())); }