Transaction Committing

In DObject O/R Mapping persistence layer, when committing transaction, the state of object related with transaction will change to committing. Transaction committing sample: Commit

var

  region : IRegion;

  region2 : IRegion;

  msg : string;

begin

  ObjectManager.BeginTransaction;

 

  region := TRegion.Create(ObjectManager);

  region.RegionID := -999;

  region.RegionDescription := '-999';

 

  msg := BoolToStr(region.RegionDescription = '-999', true);

 

  region.Save;

  msg := msg + ', ' + BoolToStr(region.RegionDescription = '-999', true);

 

  ObjectManager.Commit;

  msg := msg + ', ' + BoolToStr(region.RegionDescription = '-999', true);

 

  region2 := TRegion.GetByRegionID(ObjectManager, -999);

  msg := msg + ', ' + BoolToStr(region2 <> nil, true);

 

  region2.Delete;

 

  StatusBar.SimpleText := msg;

end;

--output result--

True, True, True, True

Related Topics

Sample