ninject / Ninject.Web.Mvc

extension for ninject providing integration with ASP.NET MVC
http://ninject.org/
Other
238 stars 85 forks source link

Should release DependencyResolver when stop NinjectMvcHttpApplicationPlugin #33

Open scott-xu opened 11 years ago

scott-xu commented 11 years ago

https://github.com/ninject/ninject.web.mvc/blob/dafbcbfcbe2e15c0de6ed24781c1d6cbf21d6c9f/mvc3/src/Ninject.Web.Mvc/NinjectMvcHttpApplicationPlugin.cs#L63

Should set resolver to null in Stop function

DependencyResolver.SetResolver(null)
scott-xu commented 11 years ago

Just realized that null is not valid for SetResolver function. Set it back to the DefaultDependencyResolver is a tricky way:

DependencyResolver.SetResolver(new DependencyResolver().InnerCurrent);

http://aspnetwebstack.codeplex.com/SourceControl/latest#src/System.Web.Mvc/DependencyResolver.cs