title: Overriding MEF Composition
body: <p>How can I override MEF composition so that if an importing constructor ask for a single dependency and there is multiple implementation of this required dependency it would take the implementation (export) with the highest priority (metadata)?</p>
  
  <pre><code>[Export(typeof(IService))]
  [ExportMetadata("Priority", 1)]
  public class Service1 : IService
  {
  }
  
  [Export(typeof(IService))]
  [ExportMetadata("Priority", 2)]
  public class Service2 : IService
  {
  }
  
  public interface IService
  {
  }
  
  public class ServiceWithDependencies
  {
      [ImportingConstructor]
      public ServiceWithDependencies(IService service)
      {
  
      }
  }
  </code></pre>
  
  <p>ServiceWithDependencies would normally not be satisfied since there is more than one implementation of IService. But I would like to modify MEF (override/intercept something) so that it would use the priority metadata and inject the implementation with the highest priority into the ServiceWithDependencies constructor.</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>I don't want MEF to dictate the way I do things. I want it to be invisible as much as possible. Furthermore, this is for a framework and I don't have control on how people will require dependencies. I need to support basic constructor injection. I know about [ImportMany], but this question is precisely about constructor injection.</p>