title: Does Simple Injector have a feature like Autofac Factory Delegates?
body: <p>Consider the scenario where a service's constructor has a mix of parameters: some you want the container to resolve based on whatever you registered, and some you want the consumer of the service to provide.</p>
  <p>With Autofac, one may add a Factory delegate to a service as follows (examples below are taken from their <a href="https://autofac.readthedocs.io/en/latest/advanced/delegate-factories.html" rel="nofollow noreferrer">documentation</a>) :</p>
  <pre><code>public class Shareholding
  {
    // We don't have to add the quote service to the factory delegate.
    public delegate Shareholding Factory(string symbol, uint holding);
  
    // Parameters in the constructor that don't show up in
    // the delegate will come from the appropriate lifetime scope.
    public Shareholding(string symbol, uint holding, IQuoteService quoteService)
    {
  ...
    }
  </code></pre>
  <p>You register the service &quot;normally&quot;:</p>
  <pre><code>builder.RegisterType&lt;Shareholding&gt;();
  </code></pre>
  <p>Autofac does some magic, and now the Factory is requestable on consumers. Autofac will supply the missing parameters (IQuoteService in this case) with whatever is registered, if possible, and provide a new instance each time the factory is invoked, e.g.:</p>
  <pre><code>public class Portfolio
  {
    private readonly Shareholding.Factory _shareHoldingFactory;
  
    private readonly List&lt;Shareholding&gt; _holdings = new List&lt;Shareholding&gt;();
  
    public Portfolio(Shareholding.Factory shareholdingFactory)
    {
      _shareHoldingFactory = shareholdingFactory;
    }
  
    public void Add(string symbol, uint holding)
    {
      _holdings.Add(_shareHoldingFactory(symbol, holding));
    }
  }
  
  </code></pre>
  <p>Does Simple Injector have something similar to this? I have gone around in circles considering and trying a few things:</p>
  <ol>
  <li>Registering an, e.g., <code>Func&lt;string, uint, QuoteService&gt;</code> won't work because then I'll need to request <code>Func&lt;string, uint, QuoteService&gt;</code> on my consumers instead of just QuoteService.Factory, which will be annoying if it's used in more than one place and the parameters are changed.</li>
  <li>I don't really want to create factory wrappers for all my services. Having been spoilt by Autofac, this just seems like too much overhead now.</li>
  <li>The <code>Register&lt;TService&gt;(Func&lt;TService&gt; instanceCreator)</code> overload won't work because the Func doesn't take parameters and there isn't an overload for one that does (right?)</li>
  </ol>
  <p>I feel like I'm missing something obvious because this is such a useful feature.</p>