I have a factory that takes in IEnumerable<IPredicate>
in the constructor. My factory signature looks like this.
public ServiceFactory(IEnumerable<IPredicate> predicates)
And here is my Windsor registering code.
container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel, false));
container.Register(Component
.For<IServiceFactory>()
.ImplementedBy<ServiceFactory>());
container.Register(AllTypes.
FromThisAssembly().
BasedOn<IPredicate>().
WithService.AllInterfaces());
container.Register(Component
.For<IEnumerable<IPredicate>>());
Windsor throws an exception when I resolve IServiceFactory
because it says I haven't registered constructor parameter predicates
. But as you can see the third component I register is the thing it says I haven't registered.
The exception is:
Keys (components with specific keys)
- predicates which was not registered.
What am I missing?
The odd thing is that I originally wrote this code in a separate project and imported it into my production project. Is it possible that I have another installer interfering with this?
I'm using Castle Windsor v2.5.1.0.