protected override void Initialize()
        {
            id1 = new EmbId {
                X = 0, Y = 1
            };
            id2 = new EmbId {
                X = 10, Y = 11
            };
            id3 = new EmbId {
                X = 20, Y = 21
            };
            id4 = new EmbId {
                X = 30, Y = 31
            };

            var refIng1 = new SetRefIngEmbIdEntity {
                Id = id1, Data = "x"
            };
            var refIng2 = new SetRefIngEmbIdEntity {
                Id = id2, Data = "y"
            };
            var refEd3 = new SetRefEdEmbIdEntity {
                Id = id3, Data = "a"
            };
            var refEd4 = new SetRefEdEmbIdEntity {
                Id = id4, Data = "a"
            };

            using (var tx = Session.BeginTransaction())
            {
                Session.Save(refIng1);
                Session.Save(refIng2);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                Session.Save(refEd3);
                Session.Save(refEd4);
                refIng1.Reference = refEd3;
                refIng2.Reference = refEd4;
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                refIng2.Reference = refEd3;
                tx.Commit();
            }
        }
Ejemplo n.º 2
0
        protected override void Initialize()
        {
            ed1_id = new EmbId {
                X = 0, Y = 1
            };
            ed2_id = new EmbId {
                X = 2, Y = 3
            };
            ing2_id = new EmbId {
                X = 4, Y = 5
            };
            ing1_id = new EmbId {
                X = 6, Y = 7
            };
            var ed1 = new SetRefEdEmbIdEntity {
                Id = ed1_id, Data = "data_ed_1"
            };
            var ed2 = new SetRefEdEmbIdEntity {
                Id = ed2_id, Data = "data_ed_2"
            };
            var ing1 = new SetRefIngEmbIdEntity {
                Id = ing1_id, Data = "data_ing_1", Reference = ed1
            };
            var ing2 = new SetRefIngEmbIdEntity {
                Id = ing2_id, Data = "data_ing_2", Reference = ed1
            };

            using (var tx = Session.BeginTransaction())
            {
                Session.Save(ed1);
                Session.Save(ed2);
                Session.Save(ing1);
                Session.Save(ing2);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                ing1.Reference = ed2;
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                ing2.Reference = ed2;
                tx.Commit();
            }
        }