Following is project structure:
- MVC 4 application 1) Project is for MVC having controller has injected interfaces. 2) interfaces are existed into this application.
- Manager library project. 1) Project contain refernece of MVC application. 2) Implementation of each interfaces into this assembly. 3) NinjectMOdule is existed into this project where binded interface with related manager class.
PROBLEM: unable to get injected classes into web application.
it gives following error:
Error No matching bindings are available, and the type is not self-bindable.
Activation path:
2) Injection of dependency ILeadInformation into parameter leadInformation of constructor of type HomeController
1) Request for HomeController
Usually in the "root" project which manages the kernel you need to load all the modules. This has to be done during initialization of the application i.E. before the application relies on the binding being there. Let's say the module which binds the
ILeadInformation
is calledLeadModule
. It would look like:EDIT:
For your concrete scenario, you have your
MVCApplication
Assembly which contains the application and some interfaces and you have yourManager
assembly, which references theMVCApplication
assembly, like so:Now you ought to place the Composition Root in the
MVCApplication
assembly. But, uh no, you can't reference theManager
assembly, since that would lead to a circular dependency. So we got to fix this. We need to move the interfaces into a new assembly. And adjust the references so it will look like: