示例#1
0
        public IActionResult GetRandomNumber()
        {
            var scopedServiceResult     = _scopedService.GetRandomNumber();
            var scopedServiceResult2    = _scopedService2.GetRandomNumber();
            var singletonServiceResult  = _singletonService.GetRandomNumber();
            var transientServiceResult  = _transientService.GetRandomNumber();
            var transientServiceResult2 = _transientService2.GetRandomNumber();
            var result =
                $"Random Singleton Number:{singletonServiceResult}\n\n" +
                $"Random Scoped Number:{scopedServiceResult}\n" +
                $"Random Scoped2 Number:{scopedServiceResult2}\n\n" +
                $"Random Transient Number:{transientServiceResult}\n" +
                $"Random Transient2 Number:{transientServiceResult2}";

            return(Ok(result));
        }