There are two ways to accomplish this. The first is to use named registration
string myFavoriteColor = ReadMyFavoriteColorFromConfigFIle();
var coloredComponent = container.Resolve<IColoredComponent>(myFavoriteColor);
The other is to use the AutoRegistration feature of Munq.
If you call Munq.Configuration.ConfigurationLoader(IocContainer container)
, the dlls in the /bin directory will be searched for classes that implement the IMunqConfig interface.
An instance will be created of each of the classes found, and the RegisterIn(IocContainer container)
method will be called. The class can then do whatever registration is required. Now you can configure your application by just dropping the 'correct'
dll(s) into the \bin directory.