public void LoadSpecial() { foreach (var init in this.Inits) { init(); var savePopulation = this.CreatePopulation(); var saveSession = savePopulation.CreateSession(); try { this.c1A = C1.Create(saveSession); this.c1A.C1AllorsString = "> <"; this.c1A.I12AllorsString = "< >"; this.c1A.I1AllorsString = "& &&"; this.c1A.S1AllorsString = "' \" ''"; this.c1Empty = C1.Create(saveSession); saveSession.Commit(); var stringWriter = new StringWriter(); var writer = new XmlTextWriter(stringWriter); savePopulation.Save(writer); writer.Close(); //writer = new XmlTextWriter(@"population.xml", Encoding.UTF8); //saveSession.Population.Save(writer); //writer.Close(); var stringReader = new StringReader(stringWriter.ToString()); var reader = new XmlTextReader(stringReader); this.Population.Load(reader); reader.Close(); using (var session = this.Population.CreateSession()) { var copyValues = C1.Instantiate(session, this.c1A.Strategy.ObjectId); Assert.AreEqual(this.c1A.C1AllorsString, copyValues.C1AllorsString); Assert.AreEqual(this.c1A.I12AllorsString, copyValues.I12AllorsString); Assert.AreEqual(this.c1A.I1AllorsString, copyValues.I1AllorsString); Assert.AreEqual(this.c1A.S1AllorsString, copyValues.S1AllorsString); var c1EmptyLoaded = C1.Instantiate(session, this.c1Empty.Strategy.ObjectId); Assert.IsNotNull(c1EmptyLoaded); } } finally { saveSession.Rollback(); } } }
private void Populate(ISession session) { this.c1A = C1.Create(session); this.c1B = C1.Create(session); this.c1C = C1.Create(session); this.c1D = C1.Create(session); this.c2A = C2.Create(session); this.c2B = C2.Create(session); this.c2C = C2.Create(session); this.c2D = C2.Create(session); this.c3A = C3.Create(session); this.c3B = C3.Create(session); this.c3C = C3.Create(session); this.c3D = C3.Create(session); this.c4A = C4.Create(session); this.c4B = C4.Create(session); this.c4C = C4.Create(session); this.c4D = C4.Create(session); IObject[] allObjects = { this.c1A, this.c1B, this.c1C, this.c1D, this.c2A, this.c2B, this.c2C, this.c2D, this.c3A, this.c3B, this.c3C, this.c3D, this.c4A, this.c4B, this.c4C, this.c4D }; this.c1A.C1AllorsString = string.Empty; // emtpy string this.c1A.C1AllorsInteger = -1; this.c1A.C1AllorsDecimal = 1.1m; this.c1A.C1AllorsDouble = 1.1d; this.c1A.C1AllorsBoolean = true; this.c1A.C1AllorsDateTime = new DateTime(1973, 3, 27, 12, 1, 2, 3, DateTimeKind.Utc); this.c1A.C1AllorsUnique = new Guid(GuidString); this.c1A.C1AllorsBinary = new byte[0]; this.c1B.C1AllorsString = "a1"; this.c1B.C1AllorsBinary = new byte[] { 0, 1, 2, 3 }; this.c1B.C1C2one2one = this.c2A; this.c1B.C1C2many2one = this.c2A; this.c1C.C1C2many2one = this.c2A; this.c1B.AddC1C2one2many(this.c2A); this.c1B.AddC1C2one2many(this.c2B); this.c1B.AddC1C2one2many(this.c2C); this.c1B.AddC1C2one2many(this.c2D); this.c1B.AddC1C2many2many(this.c2A); this.c1B.AddC1C2many2many(this.c2B); this.c1B.AddC1C2many2many(this.c2C); this.c1B.AddC1C2many2many(this.c2D); this.c1C.C1AllorsString = "a2"; this.c1C.C1AllorsBinary = null; this.c3A.I34AllorsString = "c3a"; this.c4A.I34AllorsString = "c4a"; foreach (S1234 allorsObject in allObjects) { foreach (S1234 addObject in allObjects) { allorsObject.AddS1234many2many(addObject); } } session.Commit(); }
public void LoadBinary() { foreach (var init in this.Inits) { init(); var otherPopulation = this.CreatePopulation(); var otherSession = otherPopulation.CreateSession(); try { this.c1A = C1.Create(otherSession); this.c1B = C1.Create(otherSession); this.c1C = C1.Create(otherSession); this.c1A.C1AllorsBinary = new byte[0]; this.c1B.C1AllorsBinary = new byte[] { 1, 2, 3, 4 }; this.c1C.C1AllorsBinary = null; otherSession.Commit(); var stringWriter = new StringWriter(); var writer = new XmlTextWriter(stringWriter); otherPopulation.Save(writer); writer.Close(); var xml = stringWriter.ToString(); Console.WriteLine(xml); var stringReader = new StringReader(stringWriter.ToString()); var reader = new XmlTextReader(stringReader); this.Population.Load(reader); reader.Close(); using (var session = this.Population.CreateSession()) { var c1ACopy = C1.Instantiate(session, this.c1A.Strategy.ObjectId); var c1BCopy = C1.Instantiate(session, this.c1B.Strategy.ObjectId); var c1CCopy = C1.Instantiate(session, this.c1C.Strategy.ObjectId); Assert.AreEqual(this.c1A.C1AllorsBinary, c1ACopy.C1AllorsBinary); Assert.AreEqual(this.c1B.C1AllorsBinary, c1BCopy.C1AllorsBinary); Assert.AreEqual(this.c1C.C1AllorsBinary, c1CCopy.C1AllorsBinary); } } finally { otherSession.Commit(); } } }
protected void Populate() { var population = new TestPopulation(this.Session); this.c1_0 = population.C1A; this.c1_1 = population.C1B; this.c1_2 = population.C1C; this.c1_3 = population.C1D; this.c2_0 = population.C2A; this.c2_1 = population.C2B; this.c2_2 = population.C2C; this.c2_3 = population.C2D; this.c3_0 = population.C3A; this.c3_1 = population.C3B; this.c3_2 = population.C3C; this.c3_3 = population.C3D; this.c4_0 = population.C4A; this.c4_1 = population.C4B; this.c4_2 = population.C4C; this.c4_3 = population.C4D; }
protected void Populate() { var population = new TestPopulation(this.Session); this.c1A = population.C1A; this.c1B = population.C1B; this.c1C = population.C1C; this.c1D = population.C1D; this.c2A = population.C2A; this.c2B = population.C2B; this.c2C = population.C2C; this.c2D = population.C2D; this.c3A = population.C3A; this.c3B = population.C3B; this.c3C = population.C3C; this.c3D = population.C3D; this.c4A = population.C4A; this.c4B = population.C4B; this.c4C = population.C4C; this.c4D = population.C4D; }
public TestPopulation(ISession session) { this.C1A = C1.Create(session); this.C1B = C1.Create(session); this.C1C = C1.Create(session); this.C1D = C1.Create(session); this.C2A = C2.Create(session); this.C2B = C2.Create(session); this.C2C = C2.Create(session); this.C2D = C2.Create(session); this.C3A = C3.Create(session); this.C3B = C3.Create(session); this.C3C = C3.Create(session); this.C3D = C3.Create(session); this.C4A = C4.Create(session); this.C4B = C4.Create(session); this.C4C = C4.Create(session); this.C4D = C4.Create(session); // String // class this.C1B.C1AllorsString = "Abra"; this.C1C.C1AllorsString = "Abracadabra"; this.C1D.C1AllorsString = "Abracadabra"; this.C1A.C1StringEquals = "Abra"; this.C1B.C1StringEquals = "Abra"; this.C1C.C1StringEquals = "Abra"; this.C2B.C2AllorsString = "Abra"; this.C2C.C2AllorsString = "Abracadabra"; this.C2D.C2AllorsString = "Abracadabra"; this.C3B.C3AllorsString = "Abra"; this.C3C.C3AllorsString = "Abracadabra"; this.C3D.C3AllorsString = "Abracadabra"; this.C3A.C3StringEquals = "Abra"; this.C3B.C3StringEquals = "Abra"; this.C3C.C3StringEquals = "Abra"; // exclusive interface this.C1B.I1AllorsString = "Abra"; this.C1C.I1AllorsString = "Abracadabra"; this.C1D.I1AllorsString = "Abracadabra"; this.C1A.I1StringEquals = "Abra"; this.C1B.I1StringEquals = "Abra"; this.C1C.I1StringEquals = "Abra"; this.C3B.I3AllorsString = "Abra"; this.C3C.I3AllorsString = "Abracadabra"; this.C3D.I3AllorsString = "Abracadabra"; this.C3A.I3StringEquals = "Abra"; this.C3B.I3StringEquals = "Abra"; this.C3C.I3StringEquals = "Abra"; // shared interface this.C1B.I12AllorsString = "Abra"; this.C1C.I12AllorsString = "Abracadabra"; this.C1D.I12AllorsString = "Abracadabra"; this.C2B.I12AllorsString = "Abra"; this.C2C.I12AllorsString = "Abracadabra"; this.C2D.I12AllorsString = "Abracadabra"; this.C2B.I23AllorsString = "Abra"; this.C2C.I23AllorsString = "Abracadabra"; this.C2D.I23AllorsString = "Abracadabra"; this.C3B.I23AllorsString = "Abra"; this.C3C.I23AllorsString = "Abracadabra"; this.C3D.I23AllorsString = "Abracadabra"; this.C3B.I34AllorsString = "Abra"; this.C3C.I34AllorsString = "Abracadabra"; this.C3D.I34AllorsString = "Abracadabra"; this.C4B.I34AllorsString = "Abra"; this.C4C.I34AllorsString = "Abracadabra"; this.C4D.I34AllorsString = "Abracadabra"; this.C1B.S1AllorsString = "Abra"; this.C1C.S1AllorsString = "Abracadabra"; this.C1D.S1AllorsString = "Abracadabra"; this.C1B.S1234AllorsString = "Abra"; this.C1C.S1234AllorsString = "Abracadabra"; this.C1D.S1234AllorsString = "Abracadabra"; this.C2B.S1234AllorsString = "Abra"; this.C2C.S1234AllorsString = "Abracadabra"; this.C2D.S1234AllorsString = "Abracadabra"; this.C3B.S1234AllorsString = "Abra"; this.C3C.S1234AllorsString = "Abracadabra"; this.C3D.S1234AllorsString = "Abracadabra"; this.C4B.S1234AllorsString = "Abra"; this.C4C.S1234AllorsString = "Abracadabra"; this.C4D.S1234AllorsString = "Abracadabra"; // Integer this.C1B.C1AllorsInteger = 1; this.C1C.C1AllorsInteger = 2; this.C1D.C1AllorsInteger = 2; this.C1B.C1IntegerLessThan = 0; this.C1C.C1IntegerLessThan = 2; this.C1D.C1IntegerLessThan = 4; this.C1B.C1IntegerGreaterThan = 0; this.C1C.C1IntegerGreaterThan = 2; this.C1D.C1IntegerGreaterThan = 4; this.C1B.C1IntegerBetweenA = -10; this.C1B.C1IntegerBetweenB = 0; this.C1C.C1IntegerBetweenA = 2; this.C1C.C1IntegerBetweenB = 2; this.C1D.C1IntegerBetweenA = 0; this.C1D.C1IntegerBetweenB = 10; this.C1B.I1AllorsInteger = 1; this.C1C.I1AllorsInteger = 2; this.C1D.I1AllorsInteger = 2; this.C1B.S1AllorsInteger = 1; this.C1C.S1AllorsInteger = 2; this.C1D.S1AllorsInteger = 2; this.C1B.I12AllorsInteger = 1; this.C1C.I12AllorsInteger = 2; this.C1D.I12AllorsInteger = 2; this.C2B.I12AllorsInteger = 1; this.C2C.I12AllorsInteger = 2; this.C2D.I12AllorsInteger = 2; this.C1B.S1234AllorsInteger = 1; this.C1C.S1234AllorsInteger = 2; this.C1D.S1234AllorsInteger = 2; this.C2B.S1234AllorsInteger = 1; this.C2C.S1234AllorsInteger = 2; this.C2D.S1234AllorsInteger = 2; this.C3B.S1234AllorsInteger = 1; this.C3C.S1234AllorsInteger = 2; this.C3D.S1234AllorsInteger = 2; this.C4B.S1234AllorsInteger = 1; this.C4C.S1234AllorsInteger = 2; this.C4D.S1234AllorsInteger = 2; // DateTime this.C1B.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C1C.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.C1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1B.C1DateTimeLessThan = new DateTime(2000, 1, 1, 0, 0, 3, DateTimeKind.Utc); this.C1C.C1DateTimeLessThan = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.C1DateTimeLessThan = new DateTime(2000, 1, 1, 0, 0, 7, DateTimeKind.Utc); this.C1B.C1DateTimeGreaterThan = new DateTime(2000, 1, 1, 0, 0, 3, DateTimeKind.Utc); this.C1C.C1DateTimeGreaterThan = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.C1DateTimeGreaterThan = new DateTime(2000, 1, 1, 0, 0, 7, DateTimeKind.Utc); this.C1B.C1DateTimeBetweenA = new DateTime(2000, 1, 1, 0, 0, 1, DateTimeKind.Utc); this.C1B.C1DateTimeBetweenB = new DateTime(2000, 1, 1, 0, 0, 3, DateTimeKind.Utc); this.C1C.C1DateTimeBetweenA = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1C.C1DateTimeBetweenB = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.C1DateTimeBetweenA = new DateTime(2000, 1, 1, 0, 0, 3, DateTimeKind.Utc); this.C1D.C1DateTimeBetweenB = new DateTime(2000, 1, 1, 0, 0, 10, DateTimeKind.Utc); this.C1B.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C1C.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.I1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1B.S1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C1C.S1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.S1AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1B.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C1C.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C2B.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C2C.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C2D.I12AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1B.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C1C.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C1D.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C2B.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C2C.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C2D.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C3B.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C3C.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C3D.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C4B.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 4, DateTimeKind.Utc); this.C4C.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); this.C4D.S1234AllorsDateTime = new DateTime(2000, 1, 1, 0, 0, 5, DateTimeKind.Utc); // Float this.C1B.C1AllorsDouble = 1; this.C1C.C1AllorsDouble = 2; this.C1D.C1AllorsDouble = 2; this.C1B.C1FloatLessThan = 0; this.C1C.C1FloatLessThan = 2; this.C1D.C1FloatLessThan = 4; this.C1B.C1FloatGreaterThan = 0; this.C1C.C1FloatGreaterThan = 2; this.C1D.C1FloatGreaterThan = 4; this.C1B.C1FloatBetweenA = -10; this.C1B.C1FloatBetweenB = 0; this.C1C.C1FloatBetweenA = 2; this.C1C.C1FloatBetweenB = 2; this.C1D.C1FloatBetweenA = 0; this.C1D.C1FloatBetweenB = 10; this.C1B.I1AllorsDouble = 1; this.C1C.I1AllorsDouble = 2; this.C1D.I1AllorsDouble = 2; this.C1B.S1AllorsDouble = 1; this.C1C.S1AllorsDouble = 2; this.C1D.S1AllorsDouble = 2; this.C1B.I12AllorsDouble = 1; this.C1C.I12AllorsDouble = 2; this.C1D.I12AllorsDouble = 2; this.C2B.I12AllorsDouble = 1; this.C2C.I12AllorsDouble = 2; this.C2D.I12AllorsDouble = 2; this.C1B.S1234AllorsDouble = 1; this.C1C.S1234AllorsDouble = 2; this.C1D.S1234AllorsDouble = 2; this.C2B.S1234AllorsDouble = 1; this.C2C.S1234AllorsDouble = 2; this.C2D.S1234AllorsDouble = 2; this.C3B.S1234AllorsDouble = 1; this.C3C.S1234AllorsDouble = 2; this.C3D.S1234AllorsDouble = 2; this.C4B.S1234AllorsDouble = 1; this.C4C.S1234AllorsDouble = 2; this.C4D.S1234AllorsDouble = 2; // Decimal this.C1B.C1AllorsDecimal = 1; this.C1C.C1AllorsDecimal = 2; this.C1D.C1AllorsDecimal = 2; this.C1B.C1DecimalLessThan = 0; this.C1C.C1DecimalLessThan = 2; this.C1D.C1DecimalLessThan = 4; this.C1B.C1DecimalGreaterThan = 0; this.C1C.C1DecimalGreaterThan = 2; this.C1D.C1DecimalGreaterThan = 4; this.C1B.C1DecimalBetweenA = -10; this.C1B.C1DecimalBetweenB = 0; this.C1C.C1DecimalBetweenA = 2; this.C1C.C1DecimalBetweenB = 2; this.C1D.C1DecimalBetweenA = 0; this.C1D.C1DecimalBetweenB = 10; this.C1B.I1AllorsDecimal = 1; this.C1C.I1AllorsDecimal = 2; this.C1D.I1AllorsDecimal = 2; this.C1B.S1AllorsDecimal = 1; this.C1C.S1AllorsDecimal = 2; this.C1D.S1AllorsDecimal = 2; this.C1B.I12AllorsDecimal = 1; this.C1C.I12AllorsDecimal = 2; this.C1D.I12AllorsDecimal = 2; this.C2B.I12AllorsDecimal = 1; this.C2C.I12AllorsDecimal = 2; this.C2D.I12AllorsDecimal = 2; this.C1B.S1234AllorsDecimal = 1; this.C1C.S1234AllorsDecimal = 2; this.C1D.S1234AllorsDecimal = 2; this.C2B.S1234AllorsDecimal = 1; this.C2C.S1234AllorsDecimal = 2; this.C2D.S1234AllorsDecimal = 2; this.C3B.S1234AllorsDecimal = 1; this.C3C.S1234AllorsDecimal = 2; this.C3D.S1234AllorsDecimal = 2; this.C4B.S1234AllorsDecimal = 1; this.C4C.S1234AllorsDecimal = 2; this.C4D.S1234AllorsDecimal = 2; // Composites this.C1B.C1C1one2one = this.C1B; this.C1C.C1C1one2one = this.C1C; this.C1D.C1C1one2one = this.C1D; this.C1B.C1C2one2one = this.C2B; this.C1C.C1C2one2one = this.C2C; this.C1D.C1C2one2one = this.C2D; this.C1B.C1C3one2one = this.C3B; this.C1C.C1C3one2one = this.C3C; this.C1D.C1C3one2one = this.C3D; this.C3B.C3C4one2one = this.C4B; this.C3C.C3C4one2one = this.C4C; this.C3D.C3C4one2one = this.C4D; this.C1B.I1I2one2one = this.C2B; this.C1C.I1I2one2one = this.C2C; this.C1D.I1I2one2one = this.C2D; this.C1B.S1S2one2one = this.C2B; this.C1C.S1S2one2one = this.C2C; this.C1D.S1S2one2one = this.C2D; this.C1B.I12C2one2one = this.C2B; this.C1C.I12C2one2one = this.C2C; this.C1D.I12C2one2one = this.C2D; this.C2A.I12C2one2one = this.C2A; this.C1B.I12C3one2one = this.C3B; this.C1C.I12C3one2one = this.C3C; this.C1D.I12C3one2one = this.C3D; this.C2A.I12C3one2one = this.C3A; this.C1B.S1234C2one2one = this.C2B; this.C1C.S1234C2one2one = this.C2C; this.C1D.S1234C2one2one = this.C2D; this.C2A.S1234C2one2one = this.C2A; this.C1B.C1I12one2one = this.C1B; this.C1C.C1I12one2one = this.C2B; this.C1D.C1I12one2one = this.C2C; this.C1B.S1234one2one = this.C1B; this.C1C.S1234one2one = this.C2B; this.C1D.S1234one2one = this.C3B; this.C2B.S1234one2one = this.C1C; this.C2C.S1234one2one = this.C2C; this.C2D.S1234one2one = this.C3C; this.C3B.S1234one2one = this.C1D; this.C3C.S1234one2one = this.C2D; this.C3D.S1234one2one = this.C3D; this.C1B.AddC1C1one2many(this.C1B); this.C1C.AddC1C1one2many(this.C1C); this.C1C.AddC1C1one2many(this.C1D); this.C1B.AddC1C2one2many(this.C2B); this.C1C.AddC1C2one2many(this.C2C); this.C1C.AddC1C2one2many(this.C2D); this.C3B.AddC3C4one2many(this.C4B); this.C3C.AddC3C4one2many(this.C4C); this.C3C.AddC3C4one2many(this.C4D); this.C1B.AddI1I2one2many(this.C2B); this.C1C.AddI1I2one2many(this.C2C); this.C1C.AddI1I2one2many(this.C2D); this.C1B.AddS1S2one2many(this.C2B); this.C1C.AddS1S2one2many(this.C2C); this.C1C.AddS1S2one2many(this.C2D); this.C1B.AddI12C2one2many(this.C2B); this.C2C.AddI12C2one2many(this.C2C); this.C2C.AddI12C2one2many(this.C2D); this.C1B.AddS1234C2one2many(this.C2B); this.C3C.AddS1234C2one2many(this.C2C); this.C3C.AddS1234C2one2many(this.C2D); this.C1B.AddC1I12one2many(this.C1B); this.C1C.AddC1I12one2many(this.C2C); this.C1C.AddC1I12one2many(this.C2D); this.C1B.AddS1234one2many(this.C1B); this.C3C.AddS1234one2many(this.C1C); this.C3C.AddS1234one2many(this.C1D); this.C1B.C1C1many2one = this.C1B; this.C1C.C1C1many2one = this.C1C; this.C1D.C1C1many2one = this.C1C; this.C1B.C1C2many2one = this.C2B; this.C1C.C1C2many2one = this.C2C; this.C1D.C1C2many2one = this.C2C; this.C3B.C3C4many2one = this.C4B; this.C3C.C3C4many2one = this.C4C; this.C3D.C3C4many2one = this.C4C; this.C1B.I1I2many2one = this.C2B; this.C1C.I1I2many2one = this.C2C; this.C1D.I1I2many2one = this.C2C; this.C1B.S1S2many2one = this.C2B; this.C1C.S1S2many2one = this.C2C; this.C1D.S1S2many2one = this.C2C; this.C1B.I12C2many2one = this.C2B; this.C2C.I12C2many2one = this.C2C; this.C2D.I12C2many2one = this.C2C; this.C1B.S1234C2many2one = this.C2B; this.C3C.S1234C2many2one = this.C2C; this.C3D.S1234C2many2one = this.C2C; this.C1B.C1I12many2one = this.C1B; this.C1C.C1I12many2one = this.C2C; this.C1D.C1I12many2one = this.C2C; this.C1B.S1234many2one = this.C1B; this.C3C.S1234many2one = this.C1C; this.C3D.S1234many2one = this.C1C; this.C1B.AddC1C1many2many(this.C1B); this.C1C.AddC1C1many2many(this.C1B); this.C1D.AddC1C1many2many(this.C1B); this.C1C.AddC1C1many2many(this.C1C); this.C1D.AddC1C1many2many(this.C1C); this.C1D.AddC1C1many2many(this.C1D); this.C1B.AddC1C2many2many(this.C2B); this.C1C.AddC1C2many2many(this.C2B); this.C1D.AddC1C2many2many(this.C2B); this.C1C.AddC1C2many2many(this.C2C); this.C1D.AddC1C2many2many(this.C2C); this.C1D.AddC1C2many2many(this.C2D); this.C1B.AddI1I2many2many(this.C2B); this.C1C.AddI1I2many2many(this.C2B); this.C1C.AddI1I2many2many(this.C2C); this.C1D.AddI1I2many2many(this.C2B); this.C1D.AddI1I2many2many(this.C2C); this.C1D.AddI1I2many2many(this.C2D); this.C1B.AddS1S2many2many(this.C2B); this.C1C.AddS1S2many2many(this.C2B); this.C1C.AddS1S2many2many(this.C2C); this.C1D.AddS1S2many2many(this.C2B); this.C1D.AddS1S2many2many(this.C2C); this.C1D.AddS1S2many2many(this.C2D); this.C1B.AddI12C2many2many(this.C2B); this.C1C.AddI12C2many2many(this.C2B); this.C1C.AddI12C2many2many(this.C2C); this.C1D.AddI12C2many2many(this.C2B); this.C1D.AddI12C2many2many(this.C2C); this.C1D.AddI12C2many2many(this.C2D); this.C2A.AddI12C2many2many(this.C2A); this.C2A.AddI12C2many2many(this.C2B); this.C2A.AddI12C2many2many(this.C2C); this.C2A.AddI12C2many2many(this.C2D); this.C1B.AddS1234C2many2many(this.C2B); this.C1C.AddS1234C2many2many(this.C2B); this.C1C.AddS1234C2many2many(this.C2C); this.C1D.AddS1234C2many2many(this.C2B); this.C1D.AddS1234C2many2many(this.C2C); this.C1D.AddS1234C2many2many(this.C2D); this.C2A.AddS1234C2many2many(this.C2A); this.C2A.AddS1234C2many2many(this.C2B); this.C2A.AddS1234C2many2many(this.C2C); this.C2A.AddS1234C2many2many(this.C2D); this.C1B.AddC1I12many2many(this.C1B); this.C1B.AddC1I12many2many(this.C2B); this.C1C.AddC1I12many2many(this.C2B); this.C1C.AddC1I12many2many(this.C2C); this.C1D.AddC1I12many2many(this.C2B); this.C1D.AddC1I12many2many(this.C2C); this.C1D.AddC1I12many2many(this.C2D); this.C1B.AddS1234many2many(this.C1B); this.C1B.AddS1234many2many(this.C1A); this.C1C.AddS1234many2many(this.C2B); this.C1C.AddS1234many2many(this.C1A); this.C1D.AddS1234many2many(this.C3B); this.C1D.AddS1234many2many(this.C1A); this.C2B.AddS1234many2many(this.C1C); this.C2B.AddS1234many2many(this.C1A); this.C2C.AddS1234many2many(this.C2C); this.C2C.AddS1234many2many(this.C1A); this.C2D.AddS1234many2many(this.C3C); this.C2D.AddS1234many2many(this.C1A); this.C3B.AddS1234many2many(this.C1D); this.C3B.AddS1234many2many(this.C1A); this.C3C.AddS1234many2many(this.C2D); this.C3C.AddS1234many2many(this.C1A); this.C3D.AddS1234many2many(this.C3D); this.C3D.AddS1234many2many(this.C1A); this.C1B.ClassName = "c1"; this.C3B.ClassName = "c3"; }
public void Delete() { foreach (var init in this.Inits) { init(); // Object C1 anObject = C1.Create(this.Session); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); anObject = (C1)this.Session.Instantiate(anObject.Strategy.ObjectId); Assert.IsNull(anObject); //// Commit & Rollback anObject = C1.Create(this.Session); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsTrue(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); var id = anObject.Strategy.ObjectId; anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); this.Session.Commit(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); //// Commit + Commit + Commit anObject = C1.Create(this.Session); this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsTrue(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); id = anObject.Strategy.ObjectId; this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); this.Session.Commit(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); //// Nothing + Commit + Rollback anObject = C1.Create(this.Session); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsTrue(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); id = anObject.Strategy.ObjectId; anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); //// Commit + Commit + Rollback anObject = C1.Create(this.Session); this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsTrue(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); id = anObject.Strategy.ObjectId; this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); //// Nothing + Rollback + Rollback anObject = C1.Create(this.Session); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsTrue(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); id = anObject.Strategy.ObjectId; anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); //// Commit + Rollback + Rollback anObject = C1.Create(this.Session); this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsFalse(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsFalse(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); id = anObject.Strategy.ObjectId; this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsFalse(anObject.Strategy.IsDeleted); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsFalse(anObject.Strategy.IsDeleted); //// Nothing + Rollback + Commit anObject = C1.Create(this.Session); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsTrue(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); id = anObject.Strategy.ObjectId; anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsNull(anObject); //// Commit + Rollback + Commit anObject = C1.Create(this.Session); this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); Assert.IsFalse(anObject.Strategy.IsDeleted); this.Session.Commit(); Assert.IsFalse(anObject.Strategy.IsDeleted); // instantiate anObject = C1.Create(this.Session); id = anObject.Strategy.ObjectId; this.Session.Commit(); anObject.Strategy.Delete(); Assert.IsTrue(anObject.Strategy.IsDeleted); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsFalse(anObject.Strategy.IsDeleted); this.Session.Rollback(); anObject = C1.Instantiate(this.Session, id); Assert.IsFalse(anObject.Strategy.IsDeleted); // Clean up this.Session.Commit(); foreach (C1 removeObject in this.GetExtent(Classes.C1)) { removeObject.Strategy.Delete(); } this.Session.Commit(); // Strategy var databaseSession = this.Session as ISession; if (databaseSession != null) { IStrategy aStrategy = C1.Create(this.Session).Strategy; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); aStrategy = databaseSession.InstantiateStrategy(aStrategy.ObjectId); Assert.IsNull(aStrategy); //// Commit & Rollback aStrategy = C1.Create(databaseSession).Strategy; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsTrue(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); databaseSession.Commit(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); //// Commit + Commit + Commit aStrategy = C1.Create(databaseSession).Strategy; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsTrue(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); databaseSession.Commit(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); //// Nothing + Commit + Rollback aStrategy = C1.Create(databaseSession).Strategy; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsTrue(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); //// Commit + Commit + Rollback aStrategy = C1.Create(databaseSession).Strategy; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsTrue(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); //// Nothing + Rollback + Rollback aStrategy = C1.Create(databaseSession).Strategy; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsTrue(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); //// Commit + Rollback + Rollback aStrategy = C1.Create(databaseSession).Strategy; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsFalse(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsFalse(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsFalse(aStrategy.IsDeleted); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsFalse(aStrategy.IsDeleted); //// Nothing + Rollback + Commit aStrategy = C1.Create(databaseSession).Strategy; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsTrue(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsNull(aStrategy); //// Commit + Rollback + Commit aStrategy = C1.Create(databaseSession).Strategy; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); Assert.IsFalse(aStrategy.IsDeleted); databaseSession.Commit(); Assert.IsFalse(aStrategy.IsDeleted); // instantiate aStrategy = C1.Create(databaseSession).Strategy; id = aStrategy.ObjectId; databaseSession.Commit(); aStrategy.Delete(); Assert.IsTrue(aStrategy.IsDeleted); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsFalse(aStrategy.IsDeleted); databaseSession.Rollback(); aStrategy = databaseSession.InstantiateStrategy(id); Assert.IsFalse(aStrategy.IsDeleted); // Clean up databaseSession.Commit(); foreach (C1 removeObject in this.GetExtent(Classes.C1)) { removeObject.Strategy.Delete(); } databaseSession.Commit(); } //// Units anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; anObject.Strategy.Delete(); StrategyAssert.RoleExistHasException(anObject, RoleTypes.C1AllorsString); anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; anObject.Strategy.Delete(); StrategyAssert.RoleGetHasException(anObject, RoleTypes.C1AllorsString); C1 secondObject = C1.Create(this.Session); secondObject.C1AllorsString = "b"; C1 thirdObject = C1.Create(this.Session); thirdObject.C1AllorsString = "c"; Assert.AreEqual(2, this.GetExtent(Classes.C1).Length); thirdObject.Strategy.Delete(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("b", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); secondObject.Strategy.Delete(); //// Cached anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; AllorsTestUtils.ForceRoleCaching(anObject); anObject.Strategy.Delete(); StrategyAssert.RoleExistHasException(anObject, RoleTypes.C1AllorsString); anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; AllorsTestUtils.ForceRoleCaching(anObject); anObject.Strategy.Delete(); StrategyAssert.RoleGetHasException(anObject, RoleTypes.C1AllorsString); secondObject = C1.Create(this.Session); secondObject.C1AllorsString = "b"; thirdObject = C1.Create(this.Session); thirdObject.C1AllorsString = "c"; Assert.AreEqual(2, this.GetExtent(Classes.C1).Length); AllorsTestUtils.ForceRoleCaching(secondObject); AllorsTestUtils.ForceRoleCaching(thirdObject); thirdObject.Strategy.Delete(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("b", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); secondObject.Strategy.Delete(); //// Commit anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; anObject.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleExistHasException(anObject, RoleTypes.C1AllorsString); anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; anObject.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleGetHasException(anObject, RoleTypes.C1AllorsString); secondObject = C1.Create(this.Session); secondObject.C1AllorsString = "b"; thirdObject = C1.Create(this.Session); thirdObject.C1AllorsString = "c"; Assert.AreEqual(2, this.GetExtent(Classes.C1).Length); thirdObject.Strategy.Delete(); this.Session.Commit(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("b", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); secondObject.Strategy.Delete(); this.Session.Commit(); //// Cached anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; AllorsTestUtils.ForceRoleCaching(anObject); anObject.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleExistHasException(anObject, RoleTypes.C1AllorsString); anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; AllorsTestUtils.ForceRoleCaching(anObject); anObject.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleGetHasException(anObject, RoleTypes.C1AllorsString); secondObject = C1.Create(this.Session); secondObject.C1AllorsString = "b"; thirdObject = C1.Create(this.Session); thirdObject.C1AllorsString = "c"; Assert.AreEqual(2, this.GetExtent(Classes.C1).Length); AllorsTestUtils.ForceRoleCaching(secondObject); AllorsTestUtils.ForceRoleCaching(thirdObject); thirdObject.Strategy.Delete(); this.Session.Commit(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("b", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); secondObject.Strategy.Delete(); this.Session.Commit(); //// Rollback anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; this.Session.Commit(); anObject.Strategy.Delete(); this.Session.Rollback(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("a", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); secondObject = C1.Create(this.Session); secondObject.C1AllorsString = "b"; thirdObject = C1.Create(this.Session); thirdObject.C1AllorsString = "c"; Assert.AreEqual(3, this.GetExtent(Classes.C1).Length); thirdObject.Strategy.Delete(); this.Session.Rollback(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("a", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); anObject.Strategy.Delete(); this.Session.Commit(); //// Cached anObject = C1.Create(this.Session); anObject.C1AllorsString = "a"; this.Session.Commit(); AllorsTestUtils.ForceRoleCaching(anObject); anObject.Strategy.Delete(); this.Session.Rollback(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("a", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); secondObject = C1.Create(this.Session); secondObject.C1AllorsString = "b"; thirdObject = C1.Create(this.Session); thirdObject.C1AllorsString = "c"; Assert.AreEqual(3, this.GetExtent(Classes.C1).Length); AllorsTestUtils.ForceRoleCaching(secondObject); AllorsTestUtils.ForceRoleCaching(thirdObject); thirdObject.Strategy.Delete(); this.Session.Rollback(); Assert.AreEqual(1, this.GetExtent(Classes.C1).Length); Assert.AreEqual("a", ((C1)this.GetExtent(Classes.C1)[0]).C1AllorsString); anObject.Strategy.Delete(); this.Session.Commit(); //// IComposite //// Role C1 fromC1a = C1.Create(this.Session); C1 fromC1b = C1.Create(this.Session); C1 fromC1c = C1.Create(this.Session); C1 fromC1d = C1.Create(this.Session); C1 toC1a = C1.Create(this.Session); C1 toC1b = C1.Create(this.Session); C1 toC1c = C1.Create(this.Session); C1 toC1d = C1.Create(this.Session); C2 toC2a = C2.Create(this.Session); C2 toC2b = C2.Create(this.Session); C2 toC2c = C2.Create(this.Session); C2 toC2d = C2.Create(this.Session); //// C1 <-> C1 fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C1one2one); Assert.AreEqual(0, fromC1a.C1C1one2manies.Count); Assert.AreEqual(null, fromC1a.C1C1many2one); Assert.AreEqual(0, fromC1a.C1C1many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(toC1c, fromC1b.C1C1one2one); Assert.AreEqual(2, fromC1b.C1C1one2manies.Count); Assert.AreEqual(toC1c, fromC1b.C1C1many2one); Assert.AreEqual(2, fromC1b.C1C1many2manies.Count); this.Session.Commit(); //// C1 <-> C2 fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2many2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C2many2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C2many2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C2many2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C2one2one); Assert.AreEqual(0, fromC1a.C1C2one2manies.Count); Assert.AreEqual(null, fromC1a.C1C2many2one); Assert.AreEqual(0, fromC1a.C1C2many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(toC2c, fromC1b.C1C2one2one); Assert.AreEqual(2, fromC1b.C1C2one2manies.Count); Assert.AreEqual(toC2c, fromC1b.C1C2many2one); Assert.AreEqual(2, fromC1b.C1C2many2manies.Count); this.Session.Commit(); //// Commit //// C1 <-> C1 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); this.Session.Commit(); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C1one2one); Assert.AreEqual(0, fromC1a.C1C1one2manies.Count); Assert.AreEqual(null, fromC1a.C1C1many2one); Assert.AreEqual(0, fromC1a.C1C1many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(toC1c, fromC1b.C1C1one2one); Assert.AreEqual(2, fromC1b.C1C1one2manies.Count); Assert.AreEqual(toC1c, fromC1b.C1C1many2one); Assert.AreEqual(2, fromC1b.C1C1many2manies.Count); //// C1 <-> C2 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); this.Session.Commit(); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2many2many); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2many2many); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2many2many); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2many2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C2one2one); Assert.AreEqual(0, fromC1a.C1C2one2manies.Count); Assert.AreEqual(null, fromC1a.C1C2many2one); Assert.AreEqual(0, fromC1a.C1C2many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(toC2c, fromC1b.C1C2one2one); Assert.AreEqual(2, fromC1b.C1C2one2manies.Count); Assert.AreEqual(toC2c, fromC1b.C1C2many2one); Assert.AreEqual(2, fromC1b.C1C2many2manies.Count); //// Rollback //// C1 <-> C1 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); this.Session.Rollback(); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.IsTrue(toC1c.Strategy.IsDeleted); Assert.IsTrue(toC1d.Strategy.IsDeleted); // Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); this.Session.Commit(); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC1a.C1WhereC1one2one); Assert.AreEqual(fromC1a, toC1b.C1WhereC1one2many); Assert.AreEqual(1, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(1, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(1, toC1b.C1sWhereC1many2many.Count); //// C1 <-> C2 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); this.Session.Rollback(); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.IsTrue(toC2c.Strategy.IsDeleted); Assert.IsTrue(toC2d.Strategy.IsDeleted); // Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); this.Session.Commit(); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC2a.C1WhereC2one2one); Assert.AreEqual(fromC1a, toC2b.C1WhereC2one2many); Assert.AreEqual(1, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(1, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(1, toC2b.C1sWhereC2many2many.Count); //// Cached //// C1 <-> C1 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C1one2one); Assert.AreEqual(0, fromC1a.C1C1one2manies.Count); Assert.AreEqual(null, fromC1a.C1C1many2one); Assert.AreEqual(0, fromC1a.C1C1many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(toC1c, fromC1b.C1C1one2one); Assert.AreEqual(2, fromC1b.C1C1one2manies.Count); Assert.AreEqual(toC1c, fromC1b.C1C1many2one); Assert.AreEqual(2, fromC1b.C1C1many2manies.Count); this.Session.Commit(); //// Commit fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); this.Session.Commit(); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1a, AssociationTypes.C1C1many2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationExistHasException(toC1b, AssociationTypes.C1C1many2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1one2many); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2one); StrategyAssert.AssociationGetHasException(toC1b, AssociationTypes.C1C1many2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C1one2one); Assert.AreEqual(0, fromC1a.C1C1one2manies.Count); Assert.AreEqual(null, fromC1a.C1C1many2one); Assert.AreEqual(0, fromC1a.C1C1many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(toC1c, fromC1b.C1C1one2one); Assert.AreEqual(2, fromC1b.C1C1one2manies.Count); Assert.AreEqual(toC1c, fromC1b.C1C1many2one); Assert.AreEqual(2, fromC1b.C1C1many2manies.Count); this.Session.Commit(); //// Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); this.Session.Rollback(); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.IsTrue(toC1c.Strategy.IsDeleted); Assert.IsTrue(toC1d.Strategy.IsDeleted); //// Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1b.C1C1one2one = toC1c; fromC1a.C1C1many2one = toC1a; fromC1b.C1C1many2one = toC1c; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); this.Session.Commit(); toC1a.Strategy.Delete(); toC1b.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC1a.C1WhereC1one2one); Assert.AreEqual(fromC1a, toC1b.C1WhereC1one2many); Assert.AreEqual(1, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(1, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(1, toC1b.C1sWhereC1many2many.Count); //// C1 <-> C2 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C2one2one); Assert.AreEqual(0, fromC1a.C1C2one2manies.Count); Assert.AreEqual(null, fromC1a.C1C2many2one); Assert.AreEqual(0, fromC1a.C1C2many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(toC2c, fromC1b.C1C2one2one); Assert.AreEqual(2, fromC1b.C1C2one2manies.Count); Assert.AreEqual(toC2c, fromC1b.C1C2many2one); Assert.AreEqual(2, fromC1b.C1C2many2manies.Count); this.Session.Commit(); //// Commit fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); this.Session.Commit(); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC2a, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationExistHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2one); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2many); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2many2one); StrategyAssert.AssociationGetHasException(toC2b, AssociationTypes.C1C2one2many); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, fromC1a.C1C2one2one); Assert.AreEqual(0, fromC1a.C1C2one2manies.Count); Assert.AreEqual(null, fromC1a.C1C2many2one); Assert.AreEqual(0, fromC1a.C1C2many2manies.Count); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(toC2c, fromC1b.C1C2one2one); Assert.AreEqual(2, fromC1b.C1C2one2manies.Count); Assert.AreEqual(toC2c, fromC1b.C1C2many2one); Assert.AreEqual(2, fromC1b.C1C2many2manies.Count); this.Session.Commit(); //// Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); this.Session.Rollback(); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.IsTrue(toC2c.Strategy.IsDeleted); Assert.IsTrue(toC2d.Strategy.IsDeleted); // Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1b.C1C2one2one = toC2c; fromC1a.C1C2many2one = toC2a; fromC1b.C1C2many2one = toC2c; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); this.Session.Commit(); toC2a.Strategy.Delete(); toC2b.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC2a.C1WhereC2one2one); Assert.AreEqual(fromC1a, toC2b.C1WhereC2one2many); Assert.AreEqual(1, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(1, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(1, toC2b.C1sWhereC2many2many.Count); //// Association //// C1 <-> C1 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); fromC1a.Strategy.Delete(); fromC1b.Strategy.Delete(); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, toC1a.C1WhereC1one2one); Assert.AreEqual(null, toC1b.C1WhereC1one2many); Assert.AreEqual(0, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(0, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(0, toC1b.C1sWhereC1many2many.Count); //// C1 <-> C2 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); fromC1a.Strategy.Delete(); fromC1b.Strategy.Delete(); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2many2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2many2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, toC2a.C1WhereC2one2one); Assert.AreEqual(null, toC2b.C1WhereC2one2many); Assert.AreEqual(0, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(0, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(0, toC2b.C1sWhereC2many2many.Count); //// Commit //// C1 <-> C1 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); fromC1a.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2one); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, toC1a.C1WhereC1one2one); Assert.AreEqual(null, toC1b.C1WhereC1one2many); Assert.AreEqual(0, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(0, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(0, toC1b.C1sWhereC1many2many.Count); //// C1 <-> C2 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); fromC1a.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2one); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, toC2a.C1WhereC2one2one); Assert.AreEqual(null, toC2b.C1WhereC2one2many); Assert.AreEqual(0, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(0, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(0, toC2b.C1sWhereC2many2many.Count); //// Rollback //// C1 <-> C1 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); fromC1a.Strategy.Delete(); this.Session.Rollback(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1one2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1many2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1many2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1one2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1one2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1many2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1many2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.IsTrue(toC1c.Strategy.IsDeleted); Assert.IsTrue(toC1d.Strategy.IsDeleted); // Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); this.Session.Commit(); fromC1a.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC1a.C1WhereC1one2one); Assert.AreEqual(fromC1a, toC1b.C1WhereC1one2many); Assert.AreEqual(1, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(1, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(1, toC1b.C1sWhereC1many2many.Count); //// C1 <-> C2 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); fromC1a.Strategy.Delete(); this.Session.Rollback(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2many2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2one2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2one2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2one2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2many2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2one2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.IsTrue(toC2c.Strategy.IsDeleted); Assert.IsTrue(toC2d.Strategy.IsDeleted); // Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); this.Session.Commit(); fromC1a.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC2a.C1WhereC2one2one); Assert.AreEqual(fromC1a, toC2b.C1WhereC2one2many); Assert.AreEqual(1, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(1, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(1, toC2b.C1sWhereC2many2many.Count); //// Cached //// C1 <-> C1 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceAssociationCaching(toC1a); AllorsTestUtils.ForceAssociationCaching(toC1a); fromC1a.Strategy.Delete(); fromC1b.Strategy.Delete(); Assert.AreEqual(0, toC1a.C1sWhereC1many2one.Count); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, toC1a.C1WhereC1one2one); Assert.AreEqual(null, toC1b.C1WhereC1one2many); Assert.AreEqual(0, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(0, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(0, toC1b.C1sWhereC1many2many.Count); //// Commit fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); fromC1a.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2one); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.AreEqual(null, toC1a.C1WhereC1one2one); Assert.AreEqual(null, toC1b.C1WhereC1one2many); Assert.AreEqual(0, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(0, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(0, toC1b.C1sWhereC1many2many.Count); //// Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); fromC1a.Strategy.Delete(); this.Session.Rollback(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C1many2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C1many2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1one2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1one2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1many2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C1many2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1one2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1one2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1many2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C1many2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC1a.Strategy.IsDeleted); Assert.IsTrue(toC1b.Strategy.IsDeleted); Assert.IsTrue(toC1c.Strategy.IsDeleted); Assert.IsTrue(toC1d.Strategy.IsDeleted); //// Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC1a = C1.Create(this.Session); toC1b = C1.Create(this.Session); toC1c = C1.Create(this.Session); toC1d = C1.Create(this.Session); fromC1a.C1C1one2one = toC1a; fromC1a.AddC1C1one2many(toC1a); fromC1a.AddC1C1one2many(toC1b); fromC1a.C1C1many2one = toC1a; fromC1a.AddC1C1many2many(toC1a); fromC1a.AddC1C1many2many(toC1b); fromC1b.C1C1one2one = toC1b; fromC1b.AddC1C1one2many(toC1c); fromC1b.AddC1C1one2many(toC1d); fromC1b.C1C1many2one = toC1b; fromC1b.AddC1C1many2many(toC1c); fromC1b.AddC1C1many2many(toC1d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); this.Session.Commit(); fromC1a.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC1a.Strategy.IsDeleted); Assert.IsFalse(toC1b.Strategy.IsDeleted); Assert.IsFalse(toC1c.Strategy.IsDeleted); Assert.IsFalse(toC1d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC1a.C1WhereC1one2one); Assert.AreEqual(fromC1a, toC1b.C1WhereC1one2many); Assert.AreEqual(1, toC1a.C1sWhereC1many2one.Count); Assert.AreEqual(1, toC1a.C1sWhereC1many2many.Count); Assert.AreEqual(1, toC1b.C1sWhereC1many2many.Count); //// C1 <-> C2 fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceAssociationCaching(toC2a); AllorsTestUtils.ForceAssociationCaching(toC2a); fromC1a.Strategy.Delete(); fromC1b.Strategy.Delete(); Assert.AreEqual(0, toC2a.C1sWhereC2many2one.Count); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2many2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2many2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, toC2a.C1WhereC2one2one); Assert.AreEqual(null, toC2b.C1WhereC2one2many); Assert.AreEqual(0, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(0, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(0, toC2b.C1sWhereC2many2many.Count); //// Commit fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); fromC1a.Strategy.Delete(); this.Session.Commit(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2one); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.AreEqual(null, toC2a.C1WhereC2one2one); Assert.AreEqual(null, toC2b.C1WhereC2one2many); Assert.AreEqual(0, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(0, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(0, toC2b.C1sWhereC2many2many.Count); //// Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); fromC1a.Strategy.Delete(); this.Session.Rollback(); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleGetHasException(fromC1a, RoleTypes.C1C2many2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2many2one); StrategyAssert.RoleExistHasException(fromC1a, RoleTypes.C1C2many2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2one2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2one2many); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2many2one); StrategyAssert.RoleExistHasException(fromC1b, RoleTypes.C1C2many2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2one2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2one2many); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2many2one); StrategyAssert.RoleGetHasException(fromC1b, RoleTypes.C1C2many2many); Assert.IsTrue(fromC1a.Strategy.IsDeleted); Assert.IsTrue(fromC1b.Strategy.IsDeleted); Assert.IsTrue(fromC1c.Strategy.IsDeleted); Assert.IsTrue(fromC1d.Strategy.IsDeleted); Assert.IsTrue(toC2a.Strategy.IsDeleted); Assert.IsTrue(toC2b.Strategy.IsDeleted); Assert.IsTrue(toC2c.Strategy.IsDeleted); Assert.IsTrue(toC2d.Strategy.IsDeleted); //// Commit + Rollback fromC1a = C1.Create(this.Session); fromC1b = C1.Create(this.Session); fromC1c = C1.Create(this.Session); fromC1d = C1.Create(this.Session); toC2a = C2.Create(this.Session); toC2b = C2.Create(this.Session); toC2c = C2.Create(this.Session); toC2d = C2.Create(this.Session); fromC1a.C1C2one2one = toC2a; fromC1a.AddC1C2one2many(toC2a); fromC1a.AddC1C2one2many(toC2b); fromC1a.C1C2many2one = toC2a; fromC1a.AddC1C2many2many(toC2a); fromC1a.AddC1C2many2many(toC2b); fromC1b.C1C2one2one = toC2b; fromC1b.AddC1C2one2many(toC2c); fromC1b.AddC1C2one2many(toC2d); fromC1b.C1C2many2one = toC2b; fromC1b.AddC1C2many2many(toC2c); fromC1b.AddC1C2many2many(toC2d); AllorsTestUtils.ForceRoleCaching(fromC1a); AllorsTestUtils.ForceRoleCaching(fromC1b); this.Session.Commit(); fromC1a.Strategy.Delete(); this.Session.Rollback(); Assert.IsFalse(fromC1a.Strategy.IsDeleted); Assert.IsFalse(fromC1b.Strategy.IsDeleted); Assert.IsFalse(fromC1c.Strategy.IsDeleted); Assert.IsFalse(fromC1d.Strategy.IsDeleted); Assert.IsFalse(toC2a.Strategy.IsDeleted); Assert.IsFalse(toC2b.Strategy.IsDeleted); Assert.IsFalse(toC2c.Strategy.IsDeleted); Assert.IsFalse(toC2d.Strategy.IsDeleted); Assert.AreEqual(fromC1a, toC2a.C1WhereC2one2one); Assert.AreEqual(fromC1a, toC2b.C1WhereC2one2many); Assert.AreEqual(1, toC2a.C1sWhereC2many2one.Count); Assert.AreEqual(1, toC2a.C1sWhereC2many2many.Count); Assert.AreEqual(1, toC2b.C1sWhereC2many2many.Count); //// Assignment anObject = C1.Create(this.Session); C1 c1Removed = C1.Create(this.Session); c1Removed.Strategy.Delete(); C1[] c1RemovedArray = { c1Removed }; bool error = false; try { anObject.C1C1one2one = c1Removed; } catch { error = true; } Assert.IsTrue(error); error = false; try { anObject.AddC1C1one2many(c1Removed); } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1one2manies.Count); error = false; try { anObject.C1C1one2manies = c1RemovedArray; } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1one2manies.Count); error = false; try { anObject.AddC1C1many2many(c1Removed); } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1many2manies.Count); error = false; try { anObject.C1C1many2manies = c1RemovedArray; } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1many2manies.Count); //// Commit anObject = C1.Create(this.Session); c1Removed = C1.Create(this.Session); c1Removed.Strategy.Delete(); c1RemovedArray = new C1[1]; c1RemovedArray[0] = c1Removed; this.Session.Commit(); error = false; try { anObject.C1C1one2one = c1Removed; } catch { error = true; } Assert.IsTrue(error); error = false; try { anObject.AddC1C1one2many(c1Removed); } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1one2manies.Count); error = false; try { anObject.C1C1one2manies = c1RemovedArray; } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1one2manies.Count); error = false; try { anObject.AddC1C1many2many(c1Removed); } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1many2manies.Count); error = false; try { anObject.C1C1many2manies = c1RemovedArray; } catch { error = true; } Assert.IsTrue(error); Assert.AreEqual(0, anObject.C1C1many2manies.Count); //// Rollback anObject = C1.Create(this.Session); c1Removed = C1.Create(this.Session); c1RemovedArray = new C1[1]; c1RemovedArray[0] = c1Removed; c1Removed.Strategy.Delete(); this.Session.Rollback(); error = false; try { anObject.C1C1one2one = c1Removed; } catch { error = true; } Assert.IsTrue(error); error = false; try { anObject.AddC1C1one2many(c1Removed); } catch { error = true; } Assert.IsTrue(error); error = false; try { anObject.C1C1one2manies = c1RemovedArray; } catch { error = true; } Assert.IsTrue(error); error = false; try { anObject.AddC1C1many2many(c1Removed); } catch { error = true; } Assert.IsTrue(error); error = false; try { anObject.C1C1many2manies = c1RemovedArray; } catch { error = true; } Assert.IsTrue(error); // Commit + Rollback anObject = C1.Create(this.Session); c1Removed = C1.Create(this.Session); c1RemovedArray = new C1[1]; c1RemovedArray[0] = c1Removed; this.Session.Commit(); c1Removed.Strategy.Delete(); this.Session.Rollback(); anObject.C1C1one2one = c1Removed; Assert.AreEqual(c1Removed, anObject.C1C1one2one); anObject.AddC1C1one2many(c1Removed); Assert.AreEqual(1, anObject.C1C1one2manies.Count); anObject.C1C1one2manies = c1RemovedArray; Assert.AreEqual(1, anObject.C1C1one2manies.Count); anObject.AddC1C1many2many(c1Removed); Assert.AreEqual(1, anObject.C1C1many2manies.Count); anObject.C1C1many2manies = c1RemovedArray; Assert.AreEqual(1, anObject.C1C1many2manies.Count); //// Proxy C1 proxy = C1.Create(this.Session); id = proxy.Strategy.ObjectId; this.Session.Commit(); C1 subject = C1.Instantiate(this.Session, id); subject.Strategy.Delete(); StrategyAssert.RoleExistHasException(proxy, RoleTypes.C1AllorsString); this.Session.Commit(); proxy = C1.Create(this.Session); id = proxy.Strategy.ObjectId; this.Session.Commit(); subject = C1.Instantiate(this.Session, id); subject.Strategy.Delete(); StrategyAssert.RoleGetHasException(proxy, RoleTypes.C1AllorsString); this.Session.Commit(); //// Commit proxy = C1.Create(this.Session); id = proxy.Strategy.ObjectId; this.Session.Commit(); subject = C1.Instantiate(this.Session, id); subject.Strategy.Delete(); this.Session.Commit(); subject = C1.Instantiate(this.Session, id); StrategyAssert.RoleExistHasException(proxy, RoleTypes.C1AllorsString); this.Session.Commit(); proxy = C1.Create(this.Session); id = proxy.Strategy.ObjectId; this.Session.Commit(); subject = C1.Instantiate(this.Session, id); subject.Strategy.Delete(); this.Session.Commit(); subject = C1.Instantiate(this.Session, id); StrategyAssert.RoleGetHasException(proxy, RoleTypes.C1AllorsString); this.Session.Commit(); //// Rollback proxy = C1.Create(this.Session); id = proxy.Strategy.ObjectId; this.Session.Commit(); subject = C1.Instantiate(this.Session, id); subject.Strategy.Delete(); this.Session.Rollback(); subject = C1.Instantiate(this.Session, id); Assert.IsFalse(proxy.Strategy.IsDeleted); this.Session.Commit(); //// unit roles anObject = C1.Create(this.Session); C1 anotherObject = C1.Create(this.Session); anotherObject.C1AllorsString = "value"; anObject.Strategy.Delete(); Assert.AreEqual("value", anotherObject.C1AllorsString); this.Session.Commit(); Assert.AreEqual("value", anotherObject.C1AllorsString); anObject = C1.Create(this.Session); anotherObject = C1.Create(this.Session); anotherObject.C1AllorsString = "value"; anObject.Strategy.Delete(); this.Session.Commit(); Assert.AreEqual("value", anotherObject.C1AllorsString); } }