Question

This question already has an answer here:

I have an IoC container (If you want a specific one to look at, it's very similar to Unity) and I'm working on how I want to integrate it into my application. My overall goal for this exercise is to transform this horrendous code I wrote into something much more testable.

I can create the IoC container and register types and I understand the fundamentals of how it is supposed to accomplish it's goal. My question is should I be injecting the container down into objects that need it, or should the objects that need it look it up using a Service Locator pattern? Realistically I see myself having to reference the container in two or three layers of my application.

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top