title: Dependency Injection for factory with parameters resolved at creation time
body: <p>Here's what I want to be able to do in my application:</p>
  
  <pre><code>public void BusinessLogic (IFactory workerFactory)
  {
    string specificObjectType = ... // not known in advance
    IWorkerObject workerObject = workerFactory.CreateByType(specificObjectType);
    workerObject.DoActualWork();
  }
  </code></pre>
  
  <p>In other words, I want an actual Factory that generates various kinds of <code>IWorkerObject</code> implementations on demand, and I want that Factory to be injectable. And ideally that Factory itself would be able to get those implementation object from the service container too:</p>
  
  <pre><code>public class WorkerFactory
  {
    public WorkerFactory (IServiceContainer ...)
    { ... }
  
    public IWorker CreateByType (string type)
    {
      return ...; // a thing that can be provided by the service container
    }
  }
  </code></pre>
  
  <p>The reason is that I want to be able to create (for example) a <code>SteelWorker</code> or a <code>CopperWorker</code> or an <code>AluminumWorker</code> depending on what type of metal is represented by that <code>specificObjectType</code> value. This seems like a normal Factory pattern to me, but I don't know how to make a class injectable <em>and</em> give it parameters that aren't resolved until creation time.</p>
  
  <p>If this can be done with Unity, great. If I need to work around it or use another DI framework, that is okay too.</p>