title: RegisterType with an interface in UnityContainer
body: <p>I'm using UnityContainer, and I want to register an interface not with a type, but with another interface.
  Unfortunately, I'm unable to do it cleanly..</p>
  
  <p>I have several common interfaces, which are united in one interface, and I need to register them in the container. The code is like the following:</p>
  
  <pre><code>interface IDeviceImporter {
      void ImportFromDevice();
  }
  
  interface IFileImporter {
      void ImportFromFile();
  }
  
  interface IImporter : IDeviceImporter, IFileImporter {
  }
  
  
  class Importer1: IImporter {
  }
  class Importer2: IImporter {
  }
  </code></pre>
  
  <p>When entering the library, I know which importer to use, so the code is like:</p>
  
  <pre><code>var container = new UnityContainer();
  if (useFirstImport) {
      container.RegisterType&lt;IImporter, Importer1&gt;();
  } else {
      container.RegisterType&lt;IImporter, Importer2&gt;();
  }
  </code></pre>
  
  <p>and then I want to register this specific class with IDeviceImporter and IFileImporter also. I need something like:</p>
  
  <pre><code>container.RegisterType&lt;IDeviceImporter, IImporter&gt;();
  </code></pre>
  
  <p>But with that code I'm getting an error:  <code>IImporter is an interface and cannot be constructed</code>.</p>
  
  <p>I can do it inside the condition, but then it'll be copy-paste. I can do </p>
  
  <pre><code>container.RegisterInstance&lt;IDeviceImporter&gt;(container.Resolve&lt;IImporter&gt;());
  </code></pre>
  
  <p>but it's really dirty.
  Anyone please, advice me something :)</p>