How can you dynamically and flexibly wire up your inversion of control container? Here are three easy steps to consider:
- Reflection
- Explicit
- Configuration
First, use reflection to help wire up your boiler plate or dynamic dependencies. Second, explicitly register and customize any additional dependencies that your application needs Third, use configuration last to dynamically override any of your previous settings, allowing you to make changes to your application in a live environment without having to rebuild or deploy.
Sample Code
Microsoft's Unity offers a last in win container, so if you follow the steps above in order you will have a very flexible configuration for your container!