2011-06-24 43 views
1

只是一个简单的问题。如果我有一个像这样绑定:Ninject的Nhibernate会话RequestScope

Bind<ISession>().ToMethod(context => context.Kernel.Get<ISessionManager>().GetSession()).InRequestScope(); 

(假设ISessionManager.GetSession()返回SessionFactory.OpenSession())

我需要明确关闭会话?或者当Ninject认为它超出范围时它会自动处理?

+0

可能重复[?威尔Ninject调用Dispose和关闭的NHibernate的ISession(http://stackoverflow.com/questions/5243228/will-ninject-call-dispose-and- close-the-nhibernate-isession) –

+0

不可能,它是重复的... couldnt找到你发布的最初问题 – somemvcperson

+0

我认为答案在这里:http://stackoverflow.com/questions/5243228/will- ninject-call-dispose-and-close-the-nhibernate-isession –

回答