I have a problem with fully understanding DI. Let’s assume
I have a deeply nested application (10 Layers)
Each layer is designed against an interface. e.g.: class Layer3 : InterfaceLayer3 {….}
Each layer gets it’s dependencies to the next layer injected via constructor-injection. e.g.: Layer3(InterfaceLayer4 instanceLayer4) {….}
Each layer has its own Assembly. All interfaces are separated in their own assemblies (*.dll).
If I look on the class-diagram of my application it looks great: Minimal dependencies !!!
But, I have to create the objects for injection somewhere. I do this via factories at the composition-root, close to “void main(void)”. The factories are in a “Factories.dll”.
If I look on my class-diagram again, I observe that my “Factories.dll” creates a dependency-hell: It depends on all layers.
My question: It seems DI solved my dependency-problem for my application-code, BUT I just transferred the problem now to another place: "Factories.dll". What is wrong with this argument?