title: Plugin Architecture/Dependency Injection Question
body: <p>I'm trying to figure out an architecture for plugins, but I've never worked with that. Essentially, my Program supports multiple database backends, but only one at a time.</p>
  
  <p>my idea was now to create a new Assembly (".DataCore") that contains all my Repository Interfaces (IFooRepository, IBarRepository) and a IDataPlugin Interface. Then, the Plugins have to implement all those interfaces.</p>
  
  <p>The user specifies the Name of the desired Assembly in the app.config file. My Program will then call a function within the DataCore Assembly which in turn uses Reflection to load the desired Assembly. Using reflection, I then search for the Class that implements IDataPlugin and call an Initialize() Function, which contains all the DI Bindings for Ninject.</p>
  
  <p>So my architecture looks like:</p>
  
  <blockquote>
    <p>MyProgram => new DataCoreLoader(string assemblyName) => DesiredDataPlugin.Initialize()</p>
  </blockquote>
  
  <p>i'm just not sure if that is the right way, and if I should really implement this myself using reflection. I guess there are existing Frameworks? I looked at MEF briefly, but I do not know if that would help?</p>
  
  <p>The reasons why I want my Plugins to have at least one discoverable class are a) I want to check a ProtocolVersion number against the one my program expects, to detect outdated plugins and b) My Configuration Tool should offer a list of all DataPlugins with some Metadata like Author or Description.</p>
  
  <p>It will never be needed to load more than one Data plugin at the same time, but I'm looking for something that would allow that in other areas (In another part of the application, I want to use Plugins that subscribe to Events my Application emits).</p>