I am trying to use structure map for the first time. I have used ioc containers before, but always with xml config. As structure map uses config through code (I know it can be done in xml as well, but most examples are using the config through code) I am running into some issues with references.
Let's work with the following example (not a real one):
3 assemblies.
DataLayer BusinessLayer Services
The BusinessLayer references the DataLayer (so it can retrieve data) Both the DataLayer and the BusinessLayer references the Services assembly because it contains code for logging.
I want the Log component to be managed by StructureMap so I can change the log component.
In the business layer there is also some components being served by StructureMap.
So my problem is now.
Where do I put the structure map config?
If I place it in the BusinessLayer, the DataLayer cannot use the Log component (because a reference back to the business layer would resolve in a cyclic reference). I cannot put it in the Services project because there is also some components in the BusinessLayer (and the business layer has a reference to the service assembly).
I hope I've explained myself well enough. The main issue here is that StructureMap needs a reference to an assembly before it can be configured, which I find a bit problematic to work with. Am I doing it all wrong?