java
sql
html
php
python
database
linux
regex
mysql
multithreading
silverlight
flash
json
algorithm
oracle
cocoa
delphi
mvc
asp
dom
If your implementations of IModule take a container as ctor parameter you can register each module's implementation of IFactory in the module's Initialize()method.
IModule
IFactory
Initialize()
public class MyModule : IModule { private readonly IUnityContainer container; public MyModule(IUnityContainer container) { this.container = container; } public void Initialize() { this.container.Register<IFactory, MyFactory>("MyFactory"); } } public class Shell { public Shell(IFactory[] factories) { // work with factories } }
I consider the modules to be part of the infrastructure and not the application itself so I find it acceptable to reference the container inside the modules. Nevertheless: If you ever want to move away from Unity you would have to change that code.
If you don't want to use Modules in that way you can have a look at the TecX project. It contains an enhanced configuration engine for Unity that allows you to modularize your container configuration per assembly and collect all that information from a bootstrapper.
Modules