+//\r
+// DefaultSettingsSection.cs\r
+//\r
+// Author:\r
+// Pablo Ruiz <pruiz@netway.org>\r
+//\r
+// (C) 2010 Pablo Ruiz.\r
+//
+
+#if NET_2_0
+
using System;
using System.Collections.Generic;
using System.Configuration;
public class DefaultSettingsSection : ConfigurationSection
{
// http://msdn.microsoft.com/en-us/library/system.transactions.configuration.defaultsettingssection.timeout.aspx
- [ConfigurationProperty("timeout", DefaultValue = "00:01:00")]
- [TimeSpanValidator(MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
+ [ConfigurationProperty ("timeout", DefaultValue = "00:01:00")]
+ [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
public TimeSpan Timeout {
get { return (TimeSpan)base["timeout"]; }
set {
}
// http://msdn.microsoft.com/en-us/library/system.transactions.configuration.defaultsettingssection.distributedtransactionmanagername(v=VS.90).aspx
- [ConfigurationProperty("distributedTransactionManagerName", DefaultValue = "")]
+ [ConfigurationProperty ("distributedTransactionManagerName", DefaultValue = "")]
public string DistributedTransactionManagerName {
get { return base["distributedTransactionManagerName"] as string; }
set { base["distributedTransactionManagerName"] = value; }
}
}
}
+#endif
\ No newline at end of file
+//\r
+// MachineSettingsSection.cs\r
+//\r
+// Author:\r
+// Pablo Ruiz <pruiz@netway.org>\r
+//\r
+// (C) 2010 Pablo Ruiz.\r
+//
+
+#if NET_2_0
+
using System;
using System.Collections.Generic;
using System.Configuration;
}
}
}
+#endif
\ No newline at end of file
+//\r
+// TransactionSectionGroup.cs\r
+//\r
+// Author:\r
+// Pablo Ruiz <pruiz@netway.org>\r
+//\r
+// (C) 2010 Pablo Ruiz.\r
+//
+
+#if NET_2_0
+
using System;
using System.Collections.Generic;
using System.Configuration;
}
}
}
+#endif
\ No newline at end of file
{\r
if (aborted)\r
{\r
- FireCompleted();\r
+ FireCompleted ();\r
return;\r
}
Aborted = true;\r
\r
- FireCompleted();
+ FireCompleted ();
}
bool Aborted {
if (!aborted)
info.Status = TransactionStatus.Committed;\r
\r
- FireCompleted();\r
+ FireCompleted ();\r
}
internal void InitScope (TransactionScope scope)
// Call prepare on all volatile managers.\r
foreach (IEnlistmentNotification enlist in volatiles)\r
{\r
- PreparingEnlistment pe = new PreparingEnlistment(this, enlist);\r
- ThreadPool.QueueUserWorkItem(new WaitCallback(PrepareCallbackWrapper), pe);\r
+ PreparingEnlistment pe = new PreparingEnlistment (this, enlist);\r
+ ThreadPool.QueueUserWorkItem (new WaitCallback(PrepareCallbackWrapper), pe);\r
\r
/* Wait (with timeout) for manager to prepare */\r
TimeSpan timeout = Scope != null ? Scope.Timeout : TransactionManager.DefaultTimeout;\r
throw new TransactionAbortedException ("Transaction has aborted", innerException);
}\r
\r
- void FireCompleted()\r
+ void FireCompleted ()\r
{\r
if (TransactionCompleted != null)\r
- TransactionCompleted(this, new TransactionEventArgs(this));\r
+ TransactionCompleted (this, new TransactionEventArgs(this));\r
}
static void EnsureIncompleteCurrentScope ()
{
public static class TransactionManager
{
- static TransactionManager()
+ static TransactionManager ()
{\r
- defaultSettings = ConfigurationManager.GetSection("system.transactions/defaultSettings") as DefaultSettingsSection;\r
- machineSettings = ConfigurationManager.GetSection("system.transactions/machineSettings") as MachineSettingsSection;
+ defaultSettings = ConfigurationManager.GetSection ("system.transactions/defaultSettings") as DefaultSettingsSection;\r
+ machineSettings = ConfigurationManager.GetSection ("system.transactions/machineSettings") as MachineSettingsSection;
}\r
\r
static DefaultSettingsSection defaultSettings;\r
static MachineSettingsSection machineSettings;\r
- static TimeSpan defaultTimeout = new TimeSpan(0, 1, 0); /* 60 secs */\r
- static TimeSpan maxTimeout = new TimeSpan(0, 10, 0); /* 10 mins */
+ static TimeSpan defaultTimeout = new TimeSpan (0, 1, 0); /* 60 secs */\r
+ static TimeSpan maxTimeout = new TimeSpan (0, 10, 0); /* 10 mins */
public static TimeSpan DefaultTimeout {\r
get {\r
public void TransactionCompleted_Committed ()\r
{\r
bool called = false;\r
- using (var ts = new TransactionScope())\r
+ using (var ts = new TransactionScope ())\r
{\r
var tr = Transaction.Current;\r
tr.TransactionCompleted += (s, e) => called = true;\r
- ts.Complete();\r
+ ts.Complete ();\r
}\r
\r
- Assert.IsTrue(called, "TransactionCompleted event handler not called!");\r
+ Assert.IsTrue (called, "TransactionCompleted event handler not called!");\r
}\r
\r
[Test]\r
public void TransactionCompleted_Rollback ()\r
{\r
bool called = false;\r
- using (var ts = new TransactionScope())\r
+ using (var ts = new TransactionScope ())\r
{\r
var tr = Transaction.Current;\r
tr.TransactionCompleted += (s, e) => called = true;\r
// Not calling ts.Complete() on purpose..\r
}\r
\r
- Assert.IsTrue(called, "TransactionCompleted event handler not called!");\r
+ Assert.IsTrue (called, "TransactionCompleted event handler not called!");\r
}
#endregion