We have an enterprise application where we are making a call to Database 1, call to a Webservice and then a call to Database 2, all in one sequence of event. We would like to encapsulate the whole processing in a transaction. what is the best way of implementing a distributed transaction in this scenario ?
Environment : SQL 2008, ASP.Net 3.5
Use a
TransactionScope
object and different connections (one for each database). The transaction will escalate to a distributed one automatically.From the example on the MSDN page: