I am wondering where the best place to instantiate the castle Windsor container is in a class library.
Should I simply do it in the constructor of the class I am using or is there a single entry point for assemblies that I am unaware of?
Thanks.
The configuration of an injected object graph is entirely dependent on the needs of the application that actually uses it. The point of using the container is to be able to configure dependencies at runtime - a library doesn't know anything about how it's going to be used.
Library classes should be written in a way that allows you to use any container you like, or poor-man's-dependency-injection as the consumer sees fit. Coupling a library to a container is a smell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With