如何在C#中实现MultiThreaded事务?

Ahm*_*aid 2 c# sql-server multithreading transactions

我想以并行和事务方式在不同的表上运行一组不同的命令,我该怎么做?

更多细节:

我希望所有命令都通过线程分布,但是在单个事务中,所以如果所有线程都成功,我将提交其他回滚.

Jon*_*oln 6

将TransactionScope类与DependentTransactions一起使用.请参阅http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspxhttp://msdn.microsoft.com/en-us/library/system.transactions.dependenttransaction.aspx.

这将最有可能使用DTC,因此请确保您也能快速使用DTC.