Esempio n. 1
0
        public IActionResult GetServiceData()
        {
            var transient2 = (ITransientService)_serviceProvider.GetService(typeof(ITransientService));
            var scoped2    = (IScopedService)_serviceProvider.GetService(typeof(IScopedService));
            var singleton2 = (ISingletonService)_serviceProvider.GetService(typeof(ISingletonService));

            return(Json(new
            {
                Tran1 = _transientService.GetMessage(),
                Tran2 = transient2.GetMessage(),
                Scop1 = _scopedService.GetMessage(),
                Scop2 = scoped2.GetMessage(),
                Sing1 = _singletonService.GetMessage(),
                Sing2 = singleton2.GetMessage(),
            }));
        }