I installed on my project Ninject.MVC3 via Nuget.
I read this article that to inject dependencies in my controllers, all you had to do was install Ninject, add my dependencies in NinjectMVC3.cs and ready.
So far so good, but how to retrieve the instance of an object?
public ActionResult MyAction()
{
var myObject = /* HERE ??*/
}
In the constructor of the controller I have no problems!
public class AccountController : Controller
{
public AccountController(IRepository repository) { ... } //This works!!
}
new StandardKernel().Get<IRepository>();
Is this correct? – Coachandfour