title: Resolving Generic Interface with Autofac
body: <p>Given the following code, how do I resolve the right SomeInstance in autofac?</p>
  
  <pre><code>public class BaseClass {}
  
  public class SubClass1 : BaseClass {}
  
  public class SubClass2 : BaseClass {}
  
  public interface IGenericInterface&lt;T&gt; where T : BaseClass {}
  
  public class SomeInstance1&lt;T&gt; : IGenericInterface&lt;T&gt; where T : SubClass1
  
  public class SomeInstance2&lt;T&gt; : IGenericInterface&lt;T&gt; where T : SubClass2
  </code></pre>
  
  <p>I want to choose SomeInstance1 or 2 based on the type of of the generic on the sub classes. </p>
  
  <p>So for example I have a collection of sub classes (SubClass1, 2....) and while iterating over them I want to choose the right SomeInstance class.</p>