コード例 #1
0
        protected override void Release(ISession session)
        {
            long initialCount = Sfi.Statistics.SessionCloseCount;

            session.Transaction.Commit();
            long subsequentCount = Sfi.Statistics.SessionCloseCount;

            Assert.AreEqual(initialCount + 1, subsequentCount, "Session still open after commit");
            // also make sure it was cleaned up from the internal ThreadLocal...
            Assert.IsFalse(TestableThreadLocalContext.HasBind(), "session still bound to internal ThreadLocal");
        }
コード例 #2
0
        public void ContextCleanup()
        {
            ISession session = Sfi.OpenSession();

            session.BeginTransaction();
            session.Transaction.Commit();
            Assert.IsFalse(session.IsOpen, "session open after txn completion");
            Assert.IsFalse(TestableThreadLocalContext.IsSessionBound(session), "session still bound after txn completion");

            ISession session2 = OpenSession();

            Assert.IsFalse(session.Equals(session2), "same session returned after txn completion");
            session2.Close();
            Assert.IsFalse(session2.IsOpen, "session open after closing");
            Assert.IsFalse(TestableThreadLocalContext.IsSessionBound(session2), "session still bound after closing");
        }
コード例 #3
0
 public TestableThreadLocalContext(ISessionFactoryImplementor factory)
     : base(factory)
 {
     me = this;
 }
コード例 #4
0
		public TestableThreadLocalContext(ISessionFactoryImplementor factory)
			: base(factory)
		{
			me = this;
		}