Transaction Rollback

In NObject O/R Mapping persistence layer, while the transaction rolling back, the state of object related with transaction will also rollback to what it was the last committed or original. Sample: Rollback

om.BeginTransaction();

 

Region region = new Region(om);

region.RegionID = -999;

region.RegionDescription = "-999";

 

Console.WriteLine(region.RegionDescription == "-999");

region.Save();

Console.WriteLine(region.RegionDescription == "-999");

om.Rollback();

Console.WriteLine(region.RegionDescription == "");

 

Region region2 = Region.GetByRegionID(om, -999);

Console.WriteLine(region2 == null);

--output result--

True

True

True

True

Related Topics

Sample