I'll give the simplified version of my project solution. I have the following projects in my solution. MVC, Core, Data, Common. Common holds enums, static classes, data transfer objects, etc. No logic, no assemblies. The MVC layer can access Core and Common. Core can access Data and Common. Data can access Common.
I already have my classes consuming dependencies using interfaces. I want to implement Microsoft Unity for IoC. I added the UnityConfig the MVC, Core, and Data projects. I was then able to have Unity register each projects classes. This works fine and I thought I had the problem in the bag.
One of the developers on my team is telling me that I shouldn't do it that way. That I'm adding a dependency across all three layers. I can see his point and I'm wondering what the best practice is for implementing an Microsoft Unity in this environment.
The other developer wants me to add the data layer reference to the MVC project. Then Unity could be contained to just the MVC project. I really don't like the idea of putting the data layer in scope of the MVC project. I've had bad experiences with developers making direct calls with Entity and I would much rather force them to use the Core layer (Business Layer) and have the Core layer make the database call.
I'm also considering adding a separate project just for Unity to be able to see all 3 layers. It was pointed out that this could create a problem as far as having a single composition root. Not something that I had really thought about before.
I'm really hoping for a cleaver solution that doesn't include adding a reference from MVC to the data layer.
Thank you very much in advance.