ninject / Ninject.Web.Mvc

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

Different behaviour during debug with visual studio 2012 #30

Closed lurongkai closed 3 years ago

lurongkai commented 11 years ago

Hi, I encountered a strange problem when using ninject in mvc4 project. Simply speaking, I want inject multiple IxxxRepository into controller, each IRepository constructed with IUnitOfWork implementation. IUnitOfWork implementation using InThreadScope object scope. But the problem is, everything runs as expected without vs debug, but when using VS debug and hit breakpoint in an Action, seems IxxxRepository's UnitOfWork are different. Does VS debug will cause Ninject inject different instance into one controller although that object register with InThreadScope? It strange because it just happened with VS debug mode....Can anybody helps? Update: InRequestScope has same issue with VS 2012 debug.