How can you instantiate a Controller that has an int argument? Using Ninject..
My HomeController has a constructor like this:
private int _masterId;
Public HomeController(int masterId){
_masterId = masterId;
}
I created a controller factory like this:
public class NinjectControllerFactory : DefaultControllerFactory
{
IKernel kernel = new StandardKernel(new ExampleConfigModule());
protected override IController GetControllerInstance(Type controllerType)
{
return controllerType == null ? null
: (IController)kernel.Get(controllerType, 1);
}
}