title: Castle Windsor Typed Factory, binding multiple generic constraints?
body: <p>Note: Before I begin please note this worked perfectly before the definition of ICommandHandler was changed to include multiple generic constraints, with one constraint it works fine.</p>
  
  <p>However, I do not seem to be getting multiple constraints passed into the "arguments" array of the selector. Am I missing something? </p>
  
  <p>This is called with:</p>
  
  <pre><code>   var handler = _factory.GetHandlerForCommand&lt;TCommand, TResult&gt;(command);
  </code></pre>
  
  <p>The Factory interface:</p>
  
  <pre><code>    public interface ICommandHandlerFactory
      {
          ICommandHandler&lt;TCommand, TResult&gt; GetHandlerForCommand&lt;TCommand, TResult&gt;(ICommand command) 
              where TCommand : class, ICommand 
              where TResult : IDTOBase;
      }
  </code></pre>
  
  <p>The Selector class:</p>
  
  <pre><code>    public class HandlerSelector : DefaultTypedFactoryComponentSelector 
      {
          protected override Func&lt;Castle.MicroKernel.IKernelInternal, Castle.MicroKernel.IReleasePolicy, object&gt; BuildFactoryComponent(System.Reflection.MethodInfo method, string componentName, Type componentType, System.Collections.IDictionary additionalArguments)
          {
              return new HandlerResolver(componentName,
                                                      componentType,
                                                      additionalArguments,
                                                      FallbackToResolveByTypeIfNameNotFound,
                                                      GetType()).Resolve;
          }
  
          protected override string GetComponentName(System.Reflection.MethodInfo method, object[] arguments)
          {
              return null;
          }
  
          protected override Type GetComponentType(System.Reflection.MethodInfo method, object[] arguments)
          {
              var message = arguments[0];
              var handlerType = typeof (ICommandHandler&lt;,&gt;).MakeGenericType(message.GetType());
              return handlerType;
          }
      }
  </code></pre>
  
  <p>The Windsor installer file:</p>
  
  <pre><code>           container
                  .Register(
                      Component
                          .For&lt;HandlerSelector&gt;()
                          .ImplementedBy&lt;HandlerSelector&gt;(),
                      AllTypes
                          .FromAssemblyContaining&lt;ICommandHandlerFactory&gt;()
                              .BasedOn(typeof(ICommandHandler&lt;,&gt;))
                              .WithService.Base()
                              .Configure(c =&gt; c.LifeStyle.Is(LifestyleType.PerWebRequest)),
                      Component
                          .For&lt;ICommandHandlerFactory&gt;()
  
  
                  .AsFactory(c =&gt; c.SelectedWith&lt;HandlerSelector&gt;()));
  </code></pre>