How to Inject Dependencies to Dynamically Loaded Assemblies

Viewed 2949

I have a manager class that loads various plug-in modules contained in separate assemblies through reflection. This modules are communication to the outside world (WebAPI, various other web protocols).

public class Manager
{
   public ILogger Logger; // Modules need to access this.

   private void LoadAssemblies()
   {
     // Load assemblies through reflection.
   }
}

These plug-in modules must communicate with an object contained within the manager class. How can I implement this? I thought about using dependency injection/IoC container, but how can I do this across assemblies?

Another thought that I had, that I am not thrilled with, is to have the modules reference a static class containing the resource that they need.

I appreciate any constructive comments/suggestions.

1 Answers
Related