protected override void Initialize()
        {
            var ccte = new CompositeCustomTypeEntity
            {
                Component = new Component {
                    Prop1 = "a", Prop2 = 1
                }
            };

            using (var tx = Session.BeginTransaction())
            {
                Session.Save(ccte);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                ccte.Component.Prop1 = "b";
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                ccte.Component = new Component {
                    Prop1 = "c", Prop2 = 3
                };
                tx.Commit();
            }
            ccte_id = ccte.Id;
        }
示例#2
0
        protected override void Initialize()
        {
            var ccte = new CompositeCustomTypeEntity();

            //Revision 1 (persisting 1 entity)
            using (var tx = Session.BeginTransaction())
            {
                ccte.Component = new Component {
                    Prop1 = "a", Prop2 = 1
                };
                id = (int)Session.Save(ccte);
                tx.Commit();
            }

            //Revsion 2 (changing the component)
            using (var tx = Session.BeginTransaction())
            {
                ccte.Component.Prop1 = "b";
                tx.Commit();
            }

            //Revision 3 (replacing the component)
            using (var tx = Session.BeginTransaction())
            {
                ccte.Component = new Component {
                    Prop1 = "c", Prop2 = 3
                };
                tx.Commit();
            }
        }