我有一個與參數構造函數的依賴關係。當我比1X調用操作多,它表明這個錯誤:Ninject:有多個匹配的綁定可用
Error activating IValidationPurchaseService More than one matching bindings are available. Activation path:
1) Request for IValidationPurchaseService
Suggestions:
1) Ensure that you have defined a binding for IValidationPurchaseService only once.
public ActionResult Detalhes(string regionUrl, string discountUrl, DetalhesModel detalhesModel)
{
var validationPurchaseDTO = new ValidationPurchaseDTO {...}
KernelFactory.Kernel.Bind<IValidationPurchaseService>().To<ValidationPurchaseService>()
.WithConstructorArgument("validationPurchaseDTO", validationPurchaseDTO)
.WithConstructorArgument("confirmPayment", true);
this.ValidationPurchaseService = KernelFactory.Kernel.Get<IValidationPurchaseService>();
...
}
'KernelFactory.Kernel.Bind'?在ASP.NET MVC控制器操作中?哦,我的...爲什麼你使用這個服務定位模式,而不是依賴注入? –