Abstracting IoC Container Behind a Singleton - Doing it wrong?

前端 未结 4 1575
日久生厌
日久生厌 2020-12-28 10:04

Generally, I like to keep an application completely ignorant of the IoC container. However I have ran into problems where I needed to access it. To abstract away the pain

4条回答
  •  情深已故
    2020-12-28 10:31

    Just a note: Microsoft Patterns and Practices has created a common service locator (http://www.codeplex.com/CommonServiceLocator) that most of the major IoC containers will be implementing in the near future. You can begin to use it instead of your IDependencyResolver.

    BTW: this is the common way to solve your problem and it works quite well.

提交回复
热议问题