How to implement Dependency Injection Using Ninject in MVC?
We have a requirement for implementing Dependency Injection using Ninject (third party tool) in MVC application. so how it should be done?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sujeet SumanPosted Sep 28, 2015, 2:55 AM
Mukesh KumarPosted Sep 28, 2015, 2:40 AM
First you just need to install Ninject in Visual studio from the package manager console run this command:
This will add a class to
App_Start/NinjectWebCommon.csIf you look near the bottom there is a RegisterServices method.
You simply add the code from your question there i.e.