Ninject and Custom Controller Factory

2019-08-19 01:57发布

问题:

I'm using MEF with ASP.NET MVC as demonstrated at http://blog.maartenballiauw.be/post/2009/06/17/Revised-ASPNET-MVC-and-the-Managed-Extensibility-Framework-(MEF).aspx.

When I try to use Ninject, it seems that nothing gets injected. I did some debugging, and when I reverted to the original controller factory the injection worked.

What needs to be changed, or what does Ninject need in terms of controller factories for it to work?

回答1:

Check out Nate Kohari's Ninject.Web.MVC project on GitHub. It's makes Ninject integration with ASP.NET MVC projects extremely easy.