protected override void Initialize() { var ed1 = new BiRefEdEntity { Id = 1, Data = "data_ed_1" }; var ed2 = new BiRefEdEntity { Id = 2, Data = "data_ed_2" }; var ing1 = new BiRefIngEntity { Id = 3, Data = "data_ing_1" }; using (var tx = Session.BeginTransaction()) { ing1.Reference = ed1; ed1_id = (int)Session.Save(ed1); ed2_id = (int)Session.Save(ed2); ing1_id = (int)Session.Save(ing1); tx.Commit(); } using (var tx = Session.BeginTransaction()) { ing1.Reference = ed2; tx.Commit(); } }
protected override void Initialize() { var ed1 = new BiRefEdEntity { Id = 1, Data = "data_ed_1" }; var ed2 = new BiRefEdEntity { Id = 2, Data = "data_ed_2" }; var ing1 = new BiRefIngEntity { Id = 3, Data = "data_ing_1" }; var ing2 = new BiRefIngEntity { Id = 4, Data = "data_ing_2" }; //revision1 using (var tx = Session.BeginTransaction()) { ed1Id = (int)Session.Save(ed1); ed2Id = (int)Session.Save(ed2); tx.Commit(); } //revision 2 using (var tx = Session.BeginTransaction()) { ing1.Reference = ed1; Session.Save(ing1); Session.Save(ing2); tx.Commit(); } //revision 3 using (var tx = Session.BeginTransaction()) { ing1.Reference = null; ing2.Reference = ed1; tx.Commit(); } //revision 4 using (var tx = Session.BeginTransaction()) { ing1.Reference = ed2; ing2.Reference = null; tx.Commit(); } }