c# - TransactionScope and Timeout Issue -


We know that TransactionScope class can use a user-defined timeout value. But when using exit {{block}, the timeout exception is thrown when exiting

Impossible.

The transaction scope simply stores the time when you started the transaction, then the transaction is checked at the time of doing the transaction.
There is no way to throw an exception at any arbitrary point.

In general, the only exception that can be inserted on any point execution (managed code) is ThreadAbortException .

Therefore, if you really wanted, you create a separate thread that sleeps for the duration of the timeout, then closes its original thread.
Still, this is a terrible idea.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -