I need to implement nested transactions in .NET using ADO.NET.
The situation is as follows:
--> Start Process (Begin Transaction)
--> Do DB things
--> Begin Transaction for step 1
--> Step 1
--> Commit transaction for step 1
--> Begin transaction for step 2
--> Step 2
--> Rollback transaction for step 2
--> etc ...
--> Do DB things
--> End Process(Commit or Rollback ALL commited steps --> a.k.a the process)
Can that be done with transaction scopes? Could anyone post an example?
In addition I'd need the process to work for SQL Server 2005 AND Oracle 10g databases... will transaction scopes work with both database engines?
Edit: Note this situation might happen:
Step1 is commited, Step2 is rolled back Step3 is commited.
The process is commited
(Step1 and Step3 do store data into the database, step2 does not)
On the other hand...
Step1 is commited, Step2 is rolled back Step3 is commited.
The process is rolled back.
the NO DATA IS COMMITED to the database
Note: No DB schema or domain values available