【发布时间】:2012-05-31 16:19:02
【问题描述】:
- 如何在控制器外访问
Container实例? - 我必须在课堂上使用
Container.Resolve,但我如何才能访问Container实例? - 是单例吗?
- 我可以使用
new Container()还是有像Funq.StaticContainer这样的链?
感谢 Mythz for gist hint,a) 或 b) 或 c)。
我将使用 Mythz 的解决方案,它被我接受了,但它的模式 (ServiceLocator Pattern) 存在问题,您可以check here for extra info。
【问题讨论】:
-
stackoverflow.com/questions/3139209/… 方法对我来说没问题。
标签: dependency-injection servicestack funq