Why does Ninject Mvc NinjectHttpApplication not use IControllerFactory for CreateControllerFactory()

StackOverflow https://stackoverflow.com/questions/8419157

I was looking over the Ninject MVC source code, and the method that generates a controller factory for overwriting the default is hardcoded to only return a NinjectControllerFactory, however as its set as virtual it would make more sense (in my eyes) to use an IControllerFactory.

/// <summary>
/// Creates the controller factory that is used to create the controllers.
/// </summary>
/// <returns>The created controller factory.</returns>
protected virtual NinjectControllerFactory CreateControllerFactory()
{
    return new NinjectControllerFactory(this.Kernel);
}

I love Ninject and I am sure there is a reason why it was done this way, but have a problem at the moment where I need to write my own ControllerFactory and use that, but would rather still use the NinjectHttpApplication. I know I could just inherit from NinjectControllerFactory and then override the method to return this new instance, but I would not be using any functionality from the Ninject flavour so it just seems that it would be a bit of a smell...

So is there a reason why it doesn't use IController or is this something that may be changed in the new version?

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top