HomeController home = null; var container = Global.RegisterCompent(); using (var scope = container.BeginLifetimeScope()) { home = scope.Resolve<HomeController>(); } // 依然可以被使用 home.Say();
HomeController home = null;
有了这句,当然可以用。奇怪
离开 BeginLifetimeScope 定义的域,组件不是应该被release掉嘛
HomeController home = null;
他释放了。注入的类释放