I'm using Autofac to register the controllers of my asp.net mvc 3 web application. At the moment I have to load the DLLs that contains the controllers (plugins) and after that I will register the types. Now, the problem cames from the fact that I have a PluginLoader class that will handle all the stuffs from the assembly loading to the types registration. This class is also registered in the autofac container. The problem is, how can I use that class if before resolve it I must build the container? I mean, I build the autofac container, I resolve the PluginLoader class, I call the method that scan the assembly and find the controllers but then the container is alredy built...
EDIT 1
PluginManager is the base class that manage all the plugins. It depends from the PluginLoader class that basically loads the assemblies with the Assembly.Load method and scan the DLLs to search for MVC controllers. These class are registered as singleton in the autofac container. Now, the PluginLoader should register with autofac the controllers too. But before calling the method that does this I must resolve the PluginManager class from the container and this is the problem. It seems a "circular dependency" or something similar. At the time that I resolve PluginManager the container is alredy built