title: StructureMap: Wiring (generic) implementations to an implementation of another type
body: <p>If I have an interface:</p>
  
  <pre><code>public interface IRepository&lt;T&gt;
  </code></pre>
  
  <p>And an abstract class:</p>
  
  <pre><code>public abstract class LinqToSqlRepository&lt;T, TContext&gt; : IRepository&lt;T&gt;
          where T : class
          where TContext : DataContext
  </code></pre>
  
  <p>And a whole bunch of implementations of IRepository / LinqToSqlRepository (e.g. AccountRepository, ContactRepository, etc.), what's the best way to to use StructureMap (2.5.3) to generically wire them all up?</p>
  
  <p>e.g., I want this code to pass:</p>
  
  <pre><code>[Test]    
  public void ShouldWireUpAccountRepositories
  {
    var accountRepo = ObjectFactory.GetInstance&lt;IRepository&lt;Account&gt;&gt;();
    Assert.IsInstanceOf&lt;AccountRepository&gt;(accountRepo);
  }
  </code></pre>
  
  <p>Without explicitly writing this:</p>
  
  <pre><code>ObjectFactory.Configure(x =&gt; x.ForRequestedType&lt;IRepository&lt;Account&gt;&gt;()
      .TheDefaultIsConcreteType&lt;AccountRepository&gt;());
  </code></pre>
  
  <p>In the past, we've always created a specific interface on each repository that inherited from the generic one, and used the default scanner to automatically wire all of those instances, but I'd like to be able to ask specifically for an <code>IRepository&lt;Account&gt;</code> without cluttering up the project with additional interfaces / configurations.</p>