Exemple #1
0
 public ActionResult Get()
 {
     return(Ok(new
     {
         Guid = guidService.GetGuid(),
         SingletonGuid = service.GetGuid()
     }));
 }
Exemple #2
0
 public IActionResult Index()
 {
     ViewBag.Transistion1 = $"First transision instance {_transisionService1.GetGuid().ToString()}";
     ViewBag.Transistion2 = $"Second transision instance {_transisionService2.GetGuid().ToString()}";
     ViewBag.Scope1       = $"First Scoped instance {_scopedService1.GetGuid().ToString()}";
     ViewBag.Scope2       = $"Second transision instance {_scopedService2.GetGuid().ToString()}";
     ViewBag.Singleton1   = $"First Singleton instance {_singletonService1.GetGuid().ToString()}";
     ViewBag.Singleton2   = $"Second Singleton instance {_singletonService2.GetGuid().ToString()}";
     return(View());
 }
Exemple #3
0
        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));
        }
Exemple #4
0
 public List <string> Singleton()
 {
     return(new List <string> {
         _singleton1.GetGuid(), _singleton2.GetGuid()
     });
 }
 //singleton
 public IActionResult Index()
 {
     return(View("Index", _singletonService.GetGuid()));
 }
Exemple #6
0
 public IActionResult Index()
 {
     ViewData["umanager"] = _uManager.GetGuid();
     return(View("Index", _singleton.GetGuid()));
 }