Transaction-like operations in calling two related functions in .NET?

Currently I am using a third party software XML API to implement different operations (when using this XML API, it's doing saving, updating the tables opeations without direct database connections). But the problem is how to use transaction-like operations to make sure two operations is atomic? i.e. In my program, i'm using two XML API functions:SaveObjectToA() and SaveObjectToB() to save object to two places. If either of SaveObjectToA() or SaveObjectToB() failed, then both functions needs to be rolled back (i.e. if A is not saved, then B should not be saved either).
I tried to use:
using(TransactionScope scope=new TransactionScope())
SaveObjectToA() ;
SaveObjectToB() ;

But nothing happend when SaveObjectToB()  failed and SaveObjectToA() still got saved, there is no rollback. Please advise. Thanks a lot.
Who is Participating?
icrConnect With a Mentor Commented:
Again, without the library providing details on *how* to rollback (or yourself figuring out what it does to see if you can possibly roll it back, if internal state isn't touched too much) you can't really do it.
SteveH_UKConnect With a Mentor Commented:
The XML API provided by the third party must provide rollback support, or else you will need to code wrappers that are transaction-aware.
heyday2004Author Commented:
They didnt provide that or I dont have access to that. Any other detailed suggestions or links to get transaction like wrappers to make sure the two function calls are executed or not executed together? Thanks.
Agreed with icr.
Thanks for the points :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.