In the service I'm currently developing, I need to perform a two-step operation:
- The executed request must be registered in the database (using the
Register() method); and - The request should be sent to an external web service for further processing (using the
Dispatch() method).
Given that I cannot switch the order of operations, I would like to be able to "roll back" the first if something goes wrong with the second, so that the incorrect record will not be inserted into the BD. The problem here is that, of course, I am committing a transaction inside the Register method. Is there a way to drop it back from the Dispatch method if something goes wrong?
Edit: all transactions are managed from the .NET side.
source share