title: castle windsor passing parameters
body: <p>I have a DI container and I want to pass in arguments to the constructor, via the DI container.</p>
  
  <p>ie,</p>
  
  <pre><code>public interface IPerson { }
  
  public class Person : IPerson {
      private int _personId;
  
      Person() { _personId = 0; }
      Person(int id) { _personId = id; }
  }
  ...
  Container.Register(Component.For&lt;IPerson&gt;().ImplementedBy&lt;Person&gt;().Lifestyle.Transient);
  ...
  //Person is already available
  Container.Resolve&lt;Person&gt;(55);
  
  //Person is not available
  Container.Resolve&lt;Person&gt;();
  </code></pre>
  
  <p>This is basically what I want to do.  Sometimes I need a new class created, sometimes I already have the class available.  How would I achieve this please?</p>
  
  <p>I have thought that I might be able to use dynamic parameters, but I am not sure how.</p>
  
  <p>Thank you in advance.</p>
  
  <hr>
  
  <p>A Factory pattern would make the solution elegant, however, this adds a bunch of complexity to my application, when all that is needed is a very simple solution which will work just as well.</p>
  
  <p>Passing in a single integer in myself is far far easier than writing a whole factory to do the same job.</p>