开发者

Can I use TransactionScope to do distributed transaction?

开发者 https://www.devze.com 2022-12-31 06:51 出处:网络
I have a MVC app that uses Linq2Sql to access a SQL DB. But I want create a distributed transaction to update

I have a MVC app that uses Linq2Sql to access a SQL DB. But I want create a distributed transaction to update another DB on different local server.

I want to update both in a transaction.

Can I just wrap logic in TransactionScope class???

M开发者_StackOverflowalcolm


If your database supports using TransactionScope (Informix seems to want to use IfxTransactions) then you should be able to use the transaction across multiple databases.

You can open multiple database connections within the same transaction scope. The transaction scope decides whether to create a local transaction or a distributed transaction.

The transaction scope automatically promotes a local transaction to a distributed transaction if necessary, see this article for more details: http://www.csharpcorner.com/uploadfile/mosessaur/transactionscope04142006103850am/transactionscope.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消