title: Interface inheritance and Unity resolve
body: <p>I am trying to resolve a object through it's <strong>base</strong> interface using Unity. If I have the following interfaces and classes:</p>
  
  <pre><code>interface IFoo { }
  interface IBar : IFoo { }
  class MyBar : IBar { }
  </code></pre>
  
  <p>and I want to inject <code>MyBar</code> into multiple classes like so:</p>
  
  <pre><code>class DoSomething
  {
      public DoSomething(IFoo myBar) 
      { 
          // Execute a method from IFoo implementation 
      }
  }
  
  class DoSomethingElse
  {
      public DoSomethingElse(IBar myBar) 
      { 
          // Execute a method from IBar **AND** IFoo implementation 
      }
  }
  </code></pre>
  
  <p>If I register <code>MyBar</code> like this:</p>
  
  <pre><code>container.RegisterType&lt;IBar, MyBar&gt;();
  </code></pre>
  
  <p>Unity throws an error trying to resolve for <code>IFoo</code> (see the DoSomething constructor). But <code>IBar</code> inherits from <code>IFoo</code>?</p>
  
  <p>I could register <code>MyBar</code> twice with the container like this:</p>
  
  <pre><code>container.RegisterType&lt;IFoo, MyBar&gt;();
  container.RegisterType&lt;IBar, MyBar&gt;();
  </code></pre>
  
  <p>but it feels like I should not have to do this. I might be wrong here.</p>
  
  <p>So my question is if Unity can resolve a class from its base interface? </p>