title: When using an IoC container, how to pass dynamic data / objects to a class?
body: <p>I have an Order class with the below constructor</p>
  
  <pre><code>public Order(IProduct product, short count)
  {
  this._product = product;
  this._count = count;
  }
  </code></pre>
  
  <p>I'm trying to setup Unity IoC container and obviously to construct the order object I'd need to know the count and product but these are determined at run time; the count could be any value and product can be any product e.g. Carrot, Melon, etc.</p>
  
  <p>So how to apply IoC for this?</p>
  
  <p>One approach I thought was that my constructor only accepts object dependencies then any other required property to be added using a new Initialize() method:</p>
  
  <pre><code>public Order (IProduct product)
  {
  this._product = product;
  }
  
  public Initialize(short count)
  {
  this._count = count;
  }
  </code></pre>
  
  <p>in this way whoever creates the Order object, has to call the Initialize() method afterwards so that other properties that can't be handled by the IoC container be added to it.</p>
  
  <p>Is it the approach that you recommend/use?</p>