For a new project i am using the Windsor container to provide Dependency Injection (DI). DI should provide me with loose coupling and high testability. Since i am new to the subject of dependency injection i am having trouble wrapping my head around how to use it properly.
This is what i learned for articles and googling: You should have one instant of the container running which is created at startup. The dependency's of objects should be taken care of at object creation. Well so far so good.
Now for my situation. Inside my data layer, which is in a different project, my data classes rely on some form of logging which is set inside the constructor. But since it's inside a different project it cannot access the container.
The only solution that pops to mind is creation a singleton factory-like class where the container is injected into at startup. The singleton factory holds on the the container instance and project creation of data layer class instances like a traditional factory class would do, instead now with DI.
While this would seem like a good solution, reading some articles give me the feeling like i am missing something important, that there are other options to achieve the result i want (my data layer classes created with DI). So i could use come guidance. Source code examples would be awesome, but explanations or links to other resources would also help me out a great deal.
Thanks in advance!