Pregunta

I have a class with the following constructor

 public BiddingTierSetViewModelValidator(
            IPropertyValidator allTiersMustBeContiguous,
            IPropertyValidator firstItemMustHaveZeroStartValue,
            IPropertyValidator lastItemMustHaveNullEndValue,
            IPropertyValidator allExceptLastItemMustHaveNonNullEndValue,
            IPropertyValidator biddingTierViewModelValuesCorrect)

When I run the application I get this error

Missing dependency.
Component <namespace>.BiddingTierSetViewModelValidator has a dependency on FluentValidation.Validators.IPropertyValidator, which could not be resolved.
Make sure the dependency is correctly registered in the container as a service, or provided as inline argument.

What I want to be able to do is for each of these IPropertyValidator parameters I want to pass in a different implementation. How do I set this up in Windsor?

¿Fue útil?

Solución

You could change te constructor to:

public BiddingTierSetViewModelValidator(IPropertyValidator [] propertyValidators)

Register all the validators in the container and add the following:

container.Kernel.Resolver.AddSubResolver(new CollectionResolver()); 

Good luck, Marwijn.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top