Ejemplo n.º 1
0
 public HomeController(
     TransientCreatedByContainer transient,
     ScopedCreatedByFactory scoped,
     SingletonCreatedByContainer createdByContainer,
     SingletonAddedManually manually,
     ILogger <HomeController> logger)
 {
     //_disposable = new MyDisposable();
     _logger = logger;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 1.可以通过FromService获取服务
 /// 2.HttpContext.RequestServices 获取服务
 /// </summary>
 /// <param name="singletonCreatedByContainer"></param>
 /// <returns></returns>
 public IActionResult Index([FromServices] SingletonCreatedByContainer singletonCreatedByContainer)
 {
     //HttpContext.Response.RegisterForDispose(_disposable);
     return(View());
 }