I am reading through 'Dependency Injection in .Net' and would like to being implementing some of the ideas presented. To be absolutely upfront, I would like to attempt a 'Poor Mans DI'/No DI Container -- manually managing Dependencies -- to better understand the concepts before jumping into a DI Container.
There is an example illustrated in Chapter 2 that demonstrates a Composition Root and creating the dependencies (and constructor injection). The basic idea was similar to this:
Web Project (has CompositionRoot.cs) --> Domain Project <-- DataAccess Project
The Composition root creates a DataAccess instance and passes it to the constructor of the Domain project's classes -- all of the dependencies are read from the web.config.
I am completely on board with the above idea and agree the Web Project shouldn't reference the DataAccess project. My understanding at this point is that the Web Project really does need a reference to the DataAccess project in order to create an instance via Reflection.
My questions:
My understanding would be that I would need to copy over the DataAccess.dll to the Web Project's Bin folder for everything to build. This seems very labor intensive so I would be interested in setting Visual Studio to do this for me? This was all I found thus far.
How does a DI Container resolve what I have described? ** I haven't looked into any containers yet so I am unaware if they would require a hard reference to the dependency project.