I have a set of parent-child-grandchild-greatgrandchild-greatgreatgrandchild etc tables. Each of these levels have a cost, and the cost is determined from the bottom level child table. I have in place some code on the BusinessObject AfterSave event, to grab the Child record that got saved, parent record, then grab all of its children to determine its new cost (such as changing a quantity etc). When this parent saves, it's new total gets rolled up to its parent in the same manner, an AfterSave event on the BusinessObject, and so on and so on untill we get to the top child, in which we calculate the new totals for the Top level, and call a method to refresh its data without reloading its DataTable (that was interesting
).
The Problem I'm running into is when Im Importing all of the Data in this Parent-Child-grandchild etc into the database with a transaction. I would like to be able to save all of these BusinessObject's with a transaction, and then Commit or Rollback when Im done. The problem is on the AFterSave of the first child record. It's AfterSave event, and when it tries to read its Parent record, it just hangs because that record has not been committed in the transaction. If I turn off transactional saving, it works fine, I just lack the transactional support.
Is there an easy way around this, Or is my methodology of what I'm doing just wrong?
Thanks.
Have a good Memorial Day Weekend Guys.
Robin Giltner