I have some business objects that can be either root or child objects depending on the context.
Usually I simply call DataPortal_XXX from Child_XXX to avoid duplicate code. Is there any danger of this causing nested transactions due to the transaction scope attribute on the root dataportal function in the calling class?
I could put the "update stuff" into a private function to be safe, but I I am curious whether I need to or not.
protected override void DataPortal_Update()
// do update stuff
private void Child_Update()
The transactions won't nest because that's not how TransactionScope works. The outermost "using TransactionScope" creates the transaction and all other using blocks within that outer using block just reuse the existing transaction. That transaction is committed or rolled back at that top level as the code leaves that outermost using block.
Copyright (c) Marimer LLC