コード例 #1
0
ファイル: DbFactory.cs プロジェクト: radtek/Merchistoun.Data
 public static void RunInTransactionScope(CompletionType completionType, Action action, double timeoutSeconds = 60D, OptionType optionType = OptionType.Required)
 {
     using (var t = new TransactionScope(optionType.Convert(), new TransactionOptions
     {
         Timeout = TimeSpan.FromSeconds(timeoutSeconds),
         IsolationLevel = IsolationLevel.Serializable
     }))
     {
         action();
         if (completionType == CompletionType.Commit)
         {
             t.Complete();
         }
     }
 }