title: Castle Windsor : Configure a generic service and provide a non-generic implementation fails
body: <p>Using Castle Windsor, I want to configure a generic service with a type parameter; and have it implemented by a known concrete type that implements the service with a specific type as the generic parameter. Expressed as a unit test, I would like to get the following to work:</p>
  
  <pre><code>[TestClass]
  public class WindsorTests
  {
      [TestMethod]
      public void ResolveGenericEntity_Test()
      {
          WindsorContainer container = ConfigureContainer();
          IEntity&lt;string&gt; entity = container.Resolve&lt;IEntity&lt;string&gt;&gt;();
          Assert.IsNotNull(entity);
      }
  
      private WindsorContainer ConfigureContainer()
      {
          WindsorContainer container = new WindsorContainer();
          container.AddComponent("entity", typeof(IEntity&lt;&gt;), typeof(ConcreteEntity));
          return container;
      }
  }
  
  public interface IEntity&lt;T&gt; { }
  
  public class ConcreteEntity : IEntity&lt;string&gt; {}
  </code></pre>
  
  <p>This test fails with the following exception:</p>
  
  <blockquote>
    <p>System.InvalidOperationException:
    WindsorGenericsTest.ConcreteEntity is
    not a GenericTypeDefinition.
    MakeGenericType may only be called on
    a type for which
    Type.IsGenericTypeDefinition is true.</p>
  </blockquote>
  
  <p>Now, I have found a <a href="http://forum.castleproject.org/viewtopic.php?t=4085" rel="nofollow noreferrer">post here</a> describing the same problem. The poster describes how this can be resolved by changing the DefaultGenericHandler.ResolveCore method. However, I don't feel like changing the Castle code itself and running on a custom build.</p>
  
  <p>Does anyone know how I can resolve this problem without modifying the Castle Windsor source code ? I am happy to implement a facility to support this, if that is what is needed. </p>