title: Unity Framework: Chain up Resolution
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12723867/is-it-possible-to-deduplicate-registration-in-unity">Is it possible to deduplicate registration in unity?</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to build up a resolution chain using unity xml configuration.
  What I got is something like that:</p>
  
  <pre><code>interface IFoo{}
  interface IBar : IFoo{}
  class Impl : IBar{}
  </code></pre>
  
  <p>The configuration I use looks similar to the following:</p>
  
  <pre><code>&lt;unity xmlns="schemas.microsoft.com/practices/2010/unity"&gt;
    &lt;container&gt;
      &lt;register type="IBar" mapTo="Impl"/&gt;
      &lt;register type "IFoo" mapTo="IBar"/&gt;
    &lt;/container&gt;
  &lt;/unity&gt;
  </code></pre>
  
  <p>When I invoke </p>
  
  <pre><code>unityContainer.Resolve&lt;IFoo&gt;()
  </code></pre>
  
  <p>I receive an exception telling me that IBar can not be constucted.
  I would like Unity to re-resolve the mapped type here and return Impl.</p>
  
  <p>Any Ideas how this can be done?</p>