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
Post a Comment