79114588

Date: 2024-10-22 14:39:24
Score: 0.5
Natty:
Report link

I think what you might want to do is to use TransactionScope for example in a process-pattern style at top level of your logic to contain all the single DB Transactions.

using (TransactionScope scope = new TransactionScope())
{
    //do all required stuff here
    ...
    scope.Complete();//commit top layer transaction
}

note, that since you are most likely going to operate on different connection transaction will most likely get elavated to Distributed Transaction, so I suggest you get some reading of MSDTC and Distributed Transactions - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc771686(v=ws.10)?redirectedfrom=MSDN

Here is documentation regarding TransactionScope - https://learn.microsoft.com/en-us/dotnet/api/system.transactions.transactionscope

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Robert