title: Registering Method on Generic Factory with StructureMap
body: <p>I am trying to use a method on a generic factory class in my structuremap registry.  Normally, i would use the following when registering a type using a factory method:</p>
  
  <pre><code>For&lt;Foo&gt;().Use(x =&gt; new FooFactory().GetFoo());
  </code></pre>
  
  <p>And the following when registering a generic type:</p>
  
  <pre><code>For(typeof(ISomeGeneric&lt;&gt;)).Use(typeof(SomeGeneric&lt;&gt;));
  </code></pre>
  
  <p>How can I combine the two and retrieve a generic type from a generic factory method?  I think it should be something like:</p>
  
  <pre><code>For(typeof(IFoo&lt;&gt;)).Use(typeof(x =&gt; new FooFactory&lt;&gt;().Create(someParameter));
  </code></pre>
  
  <p>This just gives a </p>
  
  <pre><code>"Cannot convert lambda expression to type object because it is not a delegate type" 
  </code></pre>
  
  <p>error.  I've tried various combinations but am stumped. Any ideas?</p>
  
  <p>Thanks.</p>