public void TestSaveWithAutoKey() { int terrKey = -1; Territory terr = new Territory(); terr.es.Connection.Name = "ForeignKeyTest"; TerritoryEx terrEx = new TerritoryEx(); terrEx.es.Connection.Name = "ForeignKeyTest"; try { using (esTransactionScope scope = new esTransactionScope()) { terr.Description = "Some New Territory"; terrEx = terr.TerritoryEx; terrEx.Notes = "Test Group"; terr.Save(); terrKey = terr.TerritoryID.Value; Assert.IsTrue(terr.TerritoryEx.es.HasData); Assert.AreEqual(terr.TerritoryID.Value, terrEx.TerritoryID.Value); terr = new Territory(); terr.es.Connection.Name = "ForeignKeyTest"; Assert.IsTrue(terr.LoadByPrimaryKey(terrKey)); Assert.IsTrue(terr.TerritoryEx.es.HasData); } } finally { // Clean up terr = new Territory(); terr.es.Connection.Name = "ForeignKeyTest"; if (terr.LoadByPrimaryKey(terrKey)) { terrEx = terr.TerritoryEx; terrEx.MarkAsDeleted(); terr.MarkAsDeleted(); terr.Save(); } } }
public TerritoryProxyStub(Territory obj, bool dirtyColumnsOnly) { theEntity = this.entity = obj; this.dirtyColumnsOnly = dirtyColumnsOnly; }
public TerritoryProxyStub(Territory obj) { theEntity = this.entity = obj; }