private void RegisterCommandHandlers(IEnumerable <Type> commandHandlerTypes) { Func <ICommandBus> commandBusLambda = () => kernel.Get <ILocalCommandBus>(); foreach (Type commandHandlerType in commandHandlerTypes) { kernel.BindCommandHandler(commandHandlerType); var interfaces = CommandHandlerBindingExtensions .GetCommandHandlerInterfaces(commandHandlerType); foreach (var handlerInterface in interfaces) { var commandType = handlerInterface.GetGenericArguments()[0]; if (!commandRouter.HasRoute(commandType)) { commandRouter.AddRoute(commandType, commandBusLambda); } } } }