title: Castle Windsor multiple implementations of interface
body: <p>I have the following installer but for some odd reason it is not resolving correctly. I have an interface where there are 2 implementations of it but want to inject the correct instance based on <code>naming conventions</code>.</p>
  
  <p>I am expecting in this instance that the correct instance of <code>ICommand</code> will be injected based on how they are named. However, for some odd reason both controllers are picking the very first instance, i.e. <code>FooCommand</code> due to it being defined first in the installer.</p>
  
  <p>Not sure what I have done wrong? Perhaps, is there an alternative way of doing this?</p>
  
  <pre><code>public interface ICommand { }
  
  public class FooCommand : ICommand { }
  
  public class BarCommand : ICommand { }
  
  public class SomeController : ApiController
  {
      public SomeController(ICommand fooCommand) { }
  }
  
  public class HelloController : ApiController
  {
      public HelloController(ICommand barCommand) { }
  }
  
  container.Register(
      Component.For&lt;ICommand&gt;()
          .Named("fooCommand")
          .ImplementedBy&lt;FooCommand&gt;()
          .LifestyleSingleton(),
      Component.For&lt;ICommand&gt;()
          .Named("barCommand")
          .ImplementedBy&lt;BarCommand&gt;()
          .LifestyleSingleton());
  </code></pre>