title: Castle Windsor, selecting service implementation depending on some context parameters
body: <p>With Castle Windsor 3.2
  I need to resolve service implementation on the fly depending on contextual parameters.
  Here is basic example of what I want to do:</p>
  
  <p>I have a service IFoo </p>
  
  <pre><code>public interface IFoo
  {
     object GetSomething();
  }
  </code></pre>
  
  <p>Implemented by 2 different classes Foo1 and Foo2 </p>
  
  <pre><code>public class FooBase
  {
     public int Number {get; private set;}
  
     public FooBase(int number)
     {
        Number = number;
     }
  }
  
  public class Foo1 : IFoo
  {
     public Foo1(int number):base(number)
     public object GetSomething()
     {
        return "Foo1";
     }
  }
  
  public class Foo2 : IFoo
  {
     public Foo2(int number):base(number)
     public object GetSomething()
     {
        return "Foo2";
     }
  }
  </code></pre>
  
  <p>I want to call the castle windsor resolve method with number as parameter, and depending on the number I want to have Foo1 or Foo2 object:</p>
  
  <pre><code>var foo1 = container.Resolve&lt;IFoo&gt;(new {number= 1});
  // foo1 is Foo1
  var foo2 = container.Resolve&lt;IFoo&gt;(new {number= 2});
  // foo2 is Foo2
  </code></pre>
  
  <p>I tried several potential solutions, but I'm realy confused because of the lack of Castle Windsor documentation and examples, adding to that most of the examples are not up to date and are using obsolete API.</p>
  
  <p>So I have seen some example using the following concepts, but none of them seemed to much my requirement :</p>
  
  <ol>
  <li>HandlerSelector </li>
  <li>Typed Factory facility</li>
  <li>UsingFactoryMethod</li>
  </ol>