Esempio n. 1
0
        public void StatefulIntercept()
        {
            StatefulInterceptor statefulInterceptor = new StatefulInterceptor();
            ISession            s = OpenSession(statefulInterceptor);

            Assert.IsNotNull(statefulInterceptor.Session);

            ITransaction t = s.BeginTransaction();
            User         u = new User("Gavin", "nivag");

            s.Persist(u);
            u.Password = "******";
            t.Commit();
            s.Close();

            s = OpenSession();
            t = s.BeginTransaction();
            IList logs = s.CreateCriteria(typeof(Log)).List();

            Assert.AreEqual(2, logs.Count);
            s.Delete(u);
            s.Delete("from Log");
            t.Commit();
            s.Close();
        }
		public void StatefulIntercept()
		{
			StatefulInterceptor statefulInterceptor = new StatefulInterceptor();
			ISession s = OpenSession(statefulInterceptor);
			Assert.IsNotNull(statefulInterceptor.Session);

			ITransaction t = s.BeginTransaction();
			User u = new User("Gavin", "nivag");
			s.Persist(u);
			u.Password = "******";
			t.Commit();
			s.Close();

			s = OpenSession();
			t = s.BeginTransaction();
			IList logs = s.CreateCriteria(typeof(Log)).List();
			Assert.AreEqual(2, logs.Count);
			s.Delete(u);
			s.Delete("from Log");
			t.Commit();
			s.Close();
		}