title: StructureMap Auto registration for generic types using Scan
body: <p>I've got an interface:</p>
  
  <pre><code>IRepository&lt;T&gt; where T : IEntity
  </code></pre>
  
  <p>while im knocking up my UI im using some fake repository implementations that just return any old data.</p>
  
  <p>They look like this:</p>
  
  <pre><code>public class FakeClientRepository : IRepository&lt;Client&gt;
  </code></pre>
  
  <p>At the moment im doing this:</p>
  
  <pre><code>ForRequestedType&lt;IRepository&lt;Client&gt;&gt;()
     .TheDefaultIsConcreteType&lt;FakeRepositories.FakeClientRepository&gt;();
  </code></pre>
  
  <p>but loads of times for all my IEntities. Is it possible to use Scan to auto register all my fake repositories for its respective IRepository?</p>
  
  <p>Edit: this is as far as I got, but i get errors saying the requested type isnt registered :(</p>
  
  <pre><code>Scan(x =&gt;
  {
      x.TheCallingAssembly();
      x.IncludeNamespaceContainingType&lt;FakeRepositories.FakeClientRepository&gt;();
      x.AddAllTypesOf(typeof(IRepository&lt;&gt;));
      x.WithDefaultConventions();
  });
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Andrew</p>