title: Autofac Resolve Open Generic Interface with Open Generic Class
body: <p>So I have an interface and class:</p>
  
  <pre><code>public interface IMyInterface&lt;T&gt; where T : ISomeEntity {}
  
  public class MyClass&lt;T&gt; : IMyInterface&lt;T&gt;
      where T : ISomeEntity {}
  </code></pre>
  
  <p>I will have some class that calls for it:</p>
  
  <pre><code>public class SomeClass : ISomeClass
  {
      public SomeClass (IMyInterface&lt;AuditEntity&gt; myInterface) {}
  }
  </code></pre>
  
  <p>I've done all sorts of things to get it to register the open generic interface and class with no luck.</p>
  
  <p>I just want to say something like:</p>
  
  <pre><code>container.RegisterType(typeof(MyClass&lt;&gt;)).As(typeof(IMyInterface&lt;&gt;));
  </code></pre>
  
  <p>It would be annoying if I have to go through and explicitly do something like:</p>
  
  <pre><code>container.RegisterType&lt;MyClass&lt;AuditEntity&gt;&gt;().As&lt;IMyInterface&lt;AuditEntity&gt;&gt;();
  </code></pre>
  
  <p>Shouldn't this be trivial?</p>