2014-01-15 61 views
0

我有以下構造函數的類在城堡中添加特定的綁定溫莎

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

當我運行的應用程序,我得到這個錯誤

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. 

我希望能夠做的是什麼這些IPropertyValidator參數中的每一個我都想在不同的實現中傳遞。我如何在溫莎設置它?

回答

2

你可以TE構造改變爲:

public BiddingTierSetViewModelValidator(IPropertyValidator [] propertyValidators) 

註冊的所有驗證在容器中,並添加以下內容:

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

祝你好運, Marwijn。