0
爲什麼我得到這個錯誤「MVCApplication1.HomeController類型沒有一個構造函數使用Unity的參數(IRepository_1,IRepository_2)」?使用Unity注入時的構造函數錯誤
Public Class HomeController
Inherits Controller
Private _repo1 As IRepository_1
Private _repo2 As IRepository_2
Private Sub New(_repo1 As IRepository_1, _repo2 As IRepository_2)
Me._repo1 = _repo1
Me._repo2 = _repo2
End Sub
Function Index() As ActionResult
Return View()
End Function
End Class
引導程序
container.RegisterType(Of HomeController)(New InjectionConstructor(New ResolvedParameter(Of IRepository_1), New ResolvedParameter(Of IRepository_2)))
完美,感謝埃文。 – imperialx 2014-09-23 13:09:16