I have a number of assemblies, each supplying their dependencies to Autofac through the use of a class that extends Autofac.Module. I have decorated each of these as a MEF export, e.g:
[Export(typeof(IModule))]
public class ContainerModule : Module
{
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
}
}
As part of client application startup, I gather together all of these modules, e.g:
var builder = new ContainerBuilder();
var path = "Path to application Bin directory";
var catalog = new DirectoryCatalog(path, "MyApp*.dll");
builder.RegisterComposablePartCatalog(catalog);
container = builder.Build();
When looking at the catalog, I can see all the modules from all the assemblies are present.
The question I have is how do I then instruct Autofac to call the Load method on each of the loaded modules?
I'm thinking some usage of builder.RegisterAssemblyModules but haven't (yet) had a eureka moment of how to tie that into the catalog.
Thanks!
r.