3 ms·
He basically just described what a container does. You put objects in the container in main, then it resolves everything else.
by UK-AL 12y ago
He basically just described what a container does. You put objects in the container in main, then it resolves everything else.
- emsy 12y agoThat's exactly what it's not. A container is a dependency in itself. Secondly, the wiring of the dependencies happens in one place in the code, not littered in the codebase or a proprietary obstruct XML file. And lastly, a loose container tends to be abused. When a dependency can be included with a simple annotation, everything depends on everything.
- UK-AL 12y agoErrr, you setup up the container in one place, normally main or somewhere at the start. Very few containers are xml only these days. There's normally section at the start like container.RegisterType<IMessageQueue, MSMQMessageQueue> container.RegisterType<IGeocoder, GoogleGeocoder> Modern containers don't even use annotations, they just scan the constructor parameters.
- moomin 12y agoYes, but they still magically figure out what goes into what. In the case that you've got a relatively flat structure (services injecting into lots of handlers) this is convenient. When you're building a complex tree, it reduces your understanding of the structure of your code.