I have read that Windsor is the best DI/I开发者_StackOverflowOC tool to use so I figured I would give it a try. I am seeing many examples of how to wire everything up using and MVC project however I need to wire up some dependency mappings using other layers of my DDD model.
I have a repository base that needs to have DbContext injected. I have a class that derives from DbContext so that will be the class that needs to be injected. Better yet, I can make an interface for it. IAppDBContext
.
Like I said before all of the samples have the wiring taking place in the Global.asax
file of the web project. Where would I wire things up in a normal class library project?
Probably you will want to bootstrap your container on application entry point. If you are writing reusable library, setting up IOC container shouldn't be its responsibility, but rather its users. If several applications use this library, they will surely want their independent container configuration.
精彩评论