2009-12-02 4 views
-1

NhibernateProfiler를 사용하여 모든 http 요청에 대해 세션을 생성한다는 결론을 얻었습니다. 그러나 ISession은 절대로 닫히지 않습니다. localSession.Close()가 실행되는 로그에서 확인할 수 있습니다. 세션을 절대로 닫지 않게 할 설정 파일이 있습니까? localSession.Close()가 세션을 물리적으로 닫지 않는 다른 이유가 있습니까? 우리는 NHibernate 2.1에있다.Nhibernate 세션 및 ASP.NET

<?xml version="1.0" encoding="utf-8" ?> 
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> 
    <session-factory> 
    <property name="connection.provider">JCDCHelper.DAL.Utilities.JCDCConnectionProvider, JCDCHelper.DAL</property> 
    <property name="dialect">NHibernate.Dialect.Sybase</property> 
    <property name="connection.release_mode">on_close</property> 
    <property name="show_sql">true</property> 
    <property name="connection.driver_class">JCDCHelper.DAL.Utilities.DataDirectSybaseDriver, JCDCHelper.DAL</property> 
    <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> 
    <property name="connection.connection_string_name">ProdSybase</property> 
    <property name="current_session_context_class">web</property> 
    </session-factory> 
    </hibernate-configuration> 

시간을내어 읽어 주셔서 감사합니다.

+0

질문이 중복되었습니다. http://stackoverflow.com/questions/1835244/nhibernate-in-asp-net-isession-help – Paco

+0

내 상사가 다른 방식으로 질문하고 싶었습니다. 죄송합니다. –

+1

http://en.wikipedia.org/wiki/Pointy-Hair_Boss – Paco

답변

0

당신은 세션을 폐기하고 있습니까? using 문으로 래핑 하시겠습니까?

+0

요청이 끝날 때 httpModule을 사용하여 닫습니다. oneSession = CurrentSessionContext.Unbind (factoryPerDB [sessionIndex]); oneSession.Flush(); oneSession.Close(); –