Timeout with TransactionScopeOptions.Suppress

I found this line in the application that I just took, and this does not make much sense.

using (new TransactionScope(TransactionScopeOption.Suppress, new TimeSpan(1,0,0))) {

This happens directly inside the nservicebus message handler method and spans the entire handler.

It seems to be trying to suppress an external transaction even after an hour of interruption. What happens when the timeout expires? I guess this is just a combination of options that don't mean anything reasonable. But how is this going?

+4
source share
1 answer

Suppress means that an external transaction is not used; and that when exposed, operations within the scope are not performed in the transaction. This allows you to perform operations outside the current transaction without affecting this transaction. eg:.

 using(var trans = new TransactionScope()) { // do operations within transaction using(var unscoped = new TransactionScope(TransactionScopeOption.Suppress)) { // do "immediate" operations } // do operations within transaction // NOTE: No trans.Complete() called } // operations performed within "scoped" are not rolled back. 

I'm not sure if timeout really makes sense with Suppress

0
source

All Articles