title: Autofac decorator + delegate factory
body: <p>I am trying to use a decorator in Autofac with a delegate factory but I can't seem to get it to resolve the parameters.</p>
  
  <pre><code>public interface IFoo
  { }
  
  public class Foo : IFoo
  {
      public Foo(string bar)
      { ... }
  }
  
  public class DecoratedFoo : IFoo
  {
      public DecoratedFoo(IFoo decorated)
      { ... }
  }
  </code></pre>
  
  <p>I would like to inject into a service like so:</p>
  
  <pre><code>public SomeService(Func&lt;string, IFoo&gt; factory)
  {
      // I would expect IFoo to be a DecoratedFoo here
      IFoo foo = factory("hello");
  }
  </code></pre>
  
  <p>I have registered components like so:</p>
  
  <pre><code>builder.RegisterType&lt;Foo&gt;()
      .Named&lt;IFoo&gt;("foo")
      .UsingConstructor(typeof(string));
  
  builder.RegisterDecorator&lt;IFoo&gt;(
      (ctx, inner) =&gt; new DecoratedFoo(inner),
      fromKey: "foo");
  </code></pre>
  
  <p>I get an error saying it cannot resolve my parameter bar. This is a simplified example but I won't know what the value of bar is (hence using the factory).</p>
  
  <p>Is there any way to accomplish what I'm doing?</p>