protected override void Initialize()
        {
            var bte1 = new BasicTestEntity1 {
                Str1 = "x", Long1 = 1
            };
            var bte2 = new BasicTestEntity1 {
                Str1 = null, Long1 = 20
            };

            using (var tx = Session.BeginTransaction())
            {
                id1 = (int)Session.Save(bte1);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                id2 = (int)Session.Save(bte2);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                bte1.Str1 = null;
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                bte2.Str1 = "y2";
                tx.Commit();
            }
        }
        protected override void Initialize()
        {
            var entity = new BasicTestEntity1 {
                Long1 = 1, Str1 = "str1"
            };

            //Revision 1
            using (var tx = Session.BeginTransaction())
            {
                id = (int)Session.Save(entity);
                tx.Commit();
            }

            ForceNewSession();

            //Revision 2 - both properties (str1 and long1) should be marked as modified
            using (var tx = Session.BeginTransaction())
            {
                entity.Str1 = "str2";
                entity      = Session.Merge(entity);
                Session.Flush();

                entity.Long1 = 2;
                Session.Flush();

                tx.Commit();
            }
        }
 protected override void Initialize()
 {
     using (var tx = Session.BeginTransaction())
     {
         var entity = new BasicTestEntity1 {
             Str1 = "x", Long1 = 1
         };
         id = (int)Session.Save(entity);
         tx.Commit();
     }
 }
Esempio n. 4
0
 protected override void Initialize()
 {
     using (var tx = Session.BeginTransaction())
     {
         var entity = new BasicTestEntity1 {
             Long1 = 1, Str1 = "str1"
         };
         Session.Save(entity);
         entity.Str1 = "str2";
         Session.Merge(entity);
         tx.Commit();
     }
 }