事务范围有时会部分提交问题吗?为什么?
嗨朋友们,
我在中使用
TransactionScope
类进行交易处理ASP.NET
但有时它可以部分提交。
任何人都可以告诉我为什么和如何解决这个问题?
我在谷歌搜索,但没有得到令人满意的解决方案。
请帮忙我
Shreeniwas
Hi Friends,
I have used TransactionScope
class for transaction handling in ASP.NET
but some times it works as partially commit.
Can any one tell me why and how to resolve this issue ?
I was googling, but got no satisfying solution.
Please help me
Shreeniwas
参考 - [MSDN]交易范围 [ ^ ]。
Refer - [MSDN] Transaction Scope[^].
System.Transactions的限制
.NET Compact Framework 2.0不支持System.Transactions命名空间。因此,实现仅适用于Windows桌面操作系统,并且将与.NET Framework 2.0,.NET Framework 3.0,.NET Framework 3.5或.NET Framework 4相对应。
请注意,如果超时, System.Transactions
基础结构将从单独的线程调用Rollback。主线程将不知道在单独的线程中发生的回滚。长事务可能会看到 非确定性行为和部分提交方案 。要解决此问题, 在创建对象时增加事务范围对象的时间范围 。
Limitations of System.Transactions
The System.Transactions namespace is not supported by .NET Compact Framework 2.0. Therefore, implementation will be for the Windows desktop operating system only and will correspond with the .NET Framework 2.0, .NET Framework 3.0, .NET Framework 3.5 or .NET Framework 4.
Note that if there is a timeout, the System.Transactions
infrastructure will call Rollback from a separate thread. The main thread will not know about a rollback occurring in the separate thread. The long transactions might see a non-deterministic behavior and partial commit scenarios. To resolve this, increase the timespan of the transaction scope object when you create the object.
您可以使用列出的任何构造函数这里 - [MSDN] TransactionScope构造函数 [ ^ ]。