protected override void Initialize() { c4_1 = new Component4 { Key = "c41", Value = "c41_value", Description = "c41_description" }; c4_2 = new Component4 { Key = "c42", Value = "c42_value2", Description = "c42_description" }; c3_1 = new Component3 { Str1 = "c31", AuditedComponent = c4_1, NonAuditedComponent = c4_2 }; c3_2 = new Component3 { Str1 = "c32", AuditedComponent = c4_1, NonAuditedComponent = c4_2 }; var ele1 = new EmbeddableListEntity1(); // Revision 1 (ele1: initially 1 element in both collections) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Add(c3_1); ele1Id = (int)Session.Save(ele1); tx.Commit(); } // Revision (still 1) (ele1: removing non-existing element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Remove(c3_2); tx.Commit(); } // Revision 2 (ele1: adding one element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Add(c3_2); tx.Commit(); } // Revision 3 (ele1: adding one existing element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Add(c3_1); tx.Commit(); } // Revision 4 (ele1: removing one existing element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Remove(c3_2); tx.Commit(); } }
protected override void Initialize() { c4_1 = new Component4 { Key = "c41", Value = "c41_value", Description = "c41_description" }; c4_2 = new Component4 { Key = "c42", Value = "c42_value2", Description = "c42_description" }; c3_1 = new Component3 { Str1 = "c31", AuditedComponent = c4_1, NonAuditedComponent = c4_2 }; c3_2 = new Component3 { Str1 = "c32", AuditedComponent = c4_1, NonAuditedComponent = c4_2 }; var ele1 = new EmbeddableListEntity1 { OtherData = "data", ComponentList = new List <Component3> { c3_1 } }; //Revision 1 (ele1: initially 1 element in both collections) using (var tx = Session.BeginTransaction()) { ele1Id = (int)Session.Save(ele1); tx.Commit(); } //Revision (still 1) (ele1: removing non-existing element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Remove(c3_2); tx.Commit(); } //Revision 2 (ele1: updating singular property and removing non-existing element) using (var tx = Session.BeginTransaction()) { ele1.OtherData = "modified"; ele1.ComponentList.Remove(c3_2); tx.Commit(); } // Revision 3 (ele1: adding one element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Add(c3_2); tx.Commit(); } // Revision 4 (ele1: adding one existing element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Add(c3_1); tx.Commit(); } // Revision 5 (ele1: removing one existing element) using (var tx = Session.BeginTransaction()) { ele1.ComponentList.Remove(c3_2); tx.Commit(); } // Revision 6 (ele1: changing singular property only) using (var tx = Session.BeginTransaction()) { ele1.OtherData = "another modification"; tx.Commit(); } }