This days I saw a pretty nice idea of implementing the setup part of a DI container – when you make the setup from code and not from configuration file. Usually when you are working with DI on a big project, you a piece of code for each component (assembly) that register into the container the instances for that component - ContainerInstaller. When you start the application or load a specific container you need to call that specific class end register all the items for that class. public class FooInstaller { public void Install(IContainer container) { container.Register<...>(...); container.Register<...>(...); } } This can be made automatically, if you define an interface like IInstaller. Using reflection or other mechanism you can automatically find this installers and run them. Another solution that I think that is pretty interesting is to define an extension method for each component (assembly) – an extension method of builder. E...
DREAMER, CRAFTER, TECHNOLOGY ENTHUSIAST, SPEAKER, TRAINER, AZURE MVP, SOLVING HARD BUSINESS PROBLEMS WITH CUTTING-EDGE TECHNOLOGY