我正在使用 Nhibernate 连接到数据库
_sessionFactory = configuration.BuildSessionFactory();
_sessionFactory = configuration.BuildSessionFactory();
_session = _sessionFactory.OpenSession(new DbInterceptor());
_sessionForSequenceQuery = _sessionFactory.OpenSession();
_sequenceQuery = _sessionForSequenceQuery.CreateSQLQuery("select nextval('sequence')");
当我需要断开与数据库的连接时,我会
_sessionForSequenceQuery.Disconnect();
_session.Disconnect();
_sessionFactory.Dispose();
但是与数据库的物理连接仍然存在。据我了解,当它认为有必要时,它会中断物理连接是 Nhibernate。我如何让他立即这样做?