Beispiel #1
0
        protected override void Initialize()
        {
            var entity = new DynamicTestEntity();

            //Revision 1 - Properties is null
            using (var tx = Session.BeginTransaction())
            {
                entity.Properties = null;
                id = (int)Session.Save(entity);
                tx.Commit();
                entity.Properties = new Hashtable();
            }
            //Revision 2 = all properties set
            using (var tx = Session.BeginTransaction())
            {
                entity.Properties.Add("Prop1", 1);
                entity.Properties.Add("Prop2", 2);
                entity.Properties.Add("Prop3", 3);
                tx.Commit();
            }
            //Revision 3 - removed one property
            using (var tx = Session.BeginTransaction())
            {
                entity.Properties.Remove("Prop1");
                tx.Commit();
            }
            //Revision 4 - properties is empty
            using (var tx = Session.BeginTransaction())
            {
                entity.Properties.Clear();
                tx.Commit();
            }
        }
Beispiel #2
0
        protected override void Initialize()
        {
            var c = new DynamicTestEntity();

            c.Properties["Name"] = "1";

            using (var tx = Session.BeginTransaction())
            {
                id = (int)Session.Save(c);
                tx.Commit();
            }

            using (var tx = Session.BeginTransaction())
            {
                c.Properties["Name"] = "2";
                tx.Commit();
            }

            //only "Name" is mapped
            using (var tx = Session.BeginTransaction())
            {
                c.Properties["Name2"] = "3";
                c.Properties["Name3"] = "4";
                c.Properties.Remove("Name");
                tx.Commit();
            }
        }
        protected override void Initialize()
        {
            var ent = new DynamicTestEntity();

            ent.Properties["Prop1"] = 1;
            ent.Properties["Prop2"] = 2;
            ent.Properties["Prop3"] = 3;
            using (var tx = Session.BeginTransaction())
            {
                id = (int)Session.Save(ent);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                ent.Properties["Prop3"] = 33;
                tx.Commit();
            }
        }