コード例 #1
0
 public void Try_test_shema_export()
 {
     using(var tx = _testHelper.CurrentSession.BeginTransaction())
     {
         var product = new Product();
         _testHelper.CurrentSession.Persist(product);
         tx.Commit();
     }
 }
コード例 #2
0
        public void Entity_exists_for_another_session()
        {
            using (var  session = _testHelper.OpenSession())
            using (var tx = session.BeginTransaction())
            {
                var product = new Product {Name = "Enhima"};
                session.Persist(product);
                tx.Commit();
            }

            using (var session = _testHelper.OpenSession())
            using (var tx = session.BeginTransaction())
            {
                var product = session.CreateQuery("from Product p where p.Name = 'Enhima'").UniqueResult<Product>();
                Assert.That(product, Is.Not.Null);
                tx.Commit();
            }
        }