Exemplo n.º 1
0
        public IEnumerable <string> Get()
        {
            var serviceProvider = Request.HttpContext.RequestServices;

            // 此处获取到的send与_send为同一个实例,表示在相同的scope;
            var send = serviceProvider.GetService(typeof(ISend)) as ISend;

            return(new string[] { _send.GetGuid(), send?.GetGuid() });
        }
Exemplo n.º 2
0
        // GET: Values
        public ActionResult Index()
        {
            ViewBag.send1 = _send.GetGuid();

            return(View());
        }
Exemplo n.º 3
0
        // GET api/values
        public IEnumerable <string> Get()
        {
            var send = Request.GetDependencyScope().GetService(typeof(ISend)) as ISend;

            return(new string[] { _send.GetGuid(), send?.GetGuid() });
        }