title: StructureMap - Scan - Generic Interface with base implementation and specific
body: <p>I have an interface something like this:</p>
  
  <pre><code>interface IGenericSetupViewModel&lt;T&gt;
  </code></pre>
  
  <p>I then have a default implemtation of this, something like this</p>
  
  <pre><code>class GenericSetupViewModel&lt;T&gt; : IGenericSetupViewModel&lt;T&gt;
  </code></pre>
  
  <p>For some specific classes i have a specific implementation like this:</p>
  
  <pre><code>class ContractSetupViewModel : GenericSetupViewModel&lt;Contract&gt;
  </code></pre>
  
  <p>Now i want to make StructureMap return the correct instance, when asking for a </p>
  
  <pre><code>ObjectFactory.GetInstance&lt;GenericSetupViewModel&lt;Contract&gt;();
  </code></pre>
  
  <p>I would like to get ContractSetupViewModel returned, when asking for anything else, i 
  would like to get an instance of</p>
  
  <pre><code>GenericSetupViewModel&lt;T&gt;
  </code></pre>
  
  <p>I tried doing this:</p>
  
  <pre><code>        StructureMap.ObjectFactory.Configure(x =&gt;
          {
              x.Scan(y =&gt;
              {
                  y.TheCallingAssembly();
                  y.AddAllTypesOf(typeof(IGenericSetupViewModel&lt;&gt;));
                  y.ConnectImplementationsToTypesClosing(typeof(IGenericSetupViewModel&lt;&gt;));
              });
          });
  </code></pre>
  
  <p>However this results in me always getting a GenericSetupViewModel and never the ContractSetupViewModel.
  I dont want to have to specify all specific viewmodels so is there anyway i can get this scan to work ?</p>