Created
February 12, 2018 12:04
-
-
Save hidegh/01a06f20d9e3ea97b30bc8c10ecd2688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static TransactionScope New(TransactionScopeOption transactionScopeOption = TransactionScopeOption.Required, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, TimeSpan? timeout = null) | |
{ | |
// NOTE: this is a fix, to avoid inner transaction timeout's to shorten the outer one... | |
if (Transaction.Current != null && transactionScopeOption == TransactionScopeOption.Required) | |
timeout = TimeSpan.FromMinutes(15); | |
var options = new TransactionOptions | |
{ | |
IsolationLevel = isolationLevel, | |
Timeout = timeout ?? TransactionManager.DefaultTimeout | |
}; | |
return new TransactionScope(transactionScopeOption, options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment