How to register and resolve open generic with two type arguments as interface with one type argument using Autofac
<h2>Problem</h2>

<p>I have a number of concrete, generic classes with two type arguments that implement a generic interface with one type argument.  For example:</p>

<pre><code>public interface ISomeService&lt;T&gt;
{
    // ...
}

public class SomeService&lt;TA, TB&gt; : ISomeService&lt;TA&gt;
{
    // ...
}
</code></pre>

<p>I register them using Autofac like this:</p>

<pre><code>var containerBuilder = new ContainerBuilder();

containerBuilder.RegisterGeneric(typeof(SomeService&lt;,&gt;))
    .As(typeof(ISomeService&lt;&gt;))
    .InstancePerLifetimeScope();

var container = containerBuilder.Build();
</code></pre>

<p>When attempting to resolve an instance of <code>ISomeService&lt;Foo&gt;</code> like this:</p>

<pre><code>var service = container.Resolve&lt;ISomeService&lt;Foo&gt;&gt;();
</code></pre>

<p>I get an <code>Autofac.Core.Registration.ComponentNotRegisteredException</code> exception saying that the requested service <code>ISomeService`1[[Foo]]</code> has not been registered.</p>

<h2>Questions</h2>

<ol>
<li>Is what I'm trying to do impossible using Autofac?</li>
<li>If so, is there a workaround?</li>
<li>If not, do other DI containers offer such a capability, e.g. SimpleInjector?</li>
</ol>