Пример #1
0
 public IActionResult Index()
 {
     ViewBag.transient1 = _transientService1.GetOperationID().ToString();
     ViewBag.transient2 = _transientService2.GetOperationID().ToString();
     ViewBag.scoped1    = _scopedService1.GetOperationID().ToString();
     ViewBag.scoped2    = _scopedService2.GetOperationID().ToString();
     ViewBag.singleton1 = _singletonService1.GetOperationID().ToString();
     ViewBag.singleton2 = _singletonService2.GetOperationID().ToString();
     return(View());
 }
        public string Get()
        {
            string result = $"Transient1 : {_transientService1.GetOperationID()} {Environment.NewLine}" +
                            $"Transient2 : {_transientService2.GetOperationID()} {Environment.NewLine}" +
                            $"Scoped1    : {_scopedService1.GetOperationID() } {Environment.NewLine}" +
                            $"Scoped2    : {_scopedService2.GetOperationID()} {Environment.NewLine}" +
                            $"Singleton1  : {_singletonService1.GetOperationID() } {Environment.NewLine}" +
                            $"singleton2    : {_singletonService2.GetOperationID()} {Environment.NewLine}";

            return(result);
        }