Author: gert
Date: 2007-10-18 04:36:46 -0400 (Thu, 18 Oct 2007)
New Revision: 87735

Modified:
   trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
   trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
Log:
* SqlConnection.cs: On 1.0 profile, IsolationLevel.Unspecified is
not valid. On 2.0 profile, when IsolationLevel.Unspecified is passed
make sure to also set SqlTransaction.IsolationLevel to
ReadCommitted. Modified exceptions to match MS.


Modified: trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog 2007-10-18 
08:33:36 UTC (rev 87734)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/ChangeLog 2007-10-18 
08:36:46 UTC (rev 87735)
@@ -1,3 +1,10 @@
+2007-10-18  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * SqlConnection.cs: On 1.0 profile, IsolationLevel.Unspecified is
+       not valid. On 2.0 profile, when IsolationLevel.Unspecified is passed
+       make sure to also set SqlTransaction.IsolationLevel to
+       ReadCommitted. Modified exceptions to match MS.
+
 2007-10-17  Nagappan <[EMAIL PROTECTED]> 
 
        * SqlParameter.cs (ConvertToFrameworkType): Added SqlDbType.Image.

Modified: trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs  
2007-10-18 08:33:36 UTC (rev 87734)
+++ trunk/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs  
2007-10-18 08:36:46 UTC (rev 87735)
@@ -337,9 +337,6 @@
                        if (transaction != null)
                                throw new InvalidOperationException 
("SqlConnection does not support parallel transactions.");
 
-                       if (iso == IsolationLevel.Chaos)
-                               throw new ArgumentException ("Invalid 
IsolationLevel parameter: must be ReadCommitted, ReadUncommitted, 
RepeatableRead, or Serializable.");
-
                        string isolevel = String.Empty;
                        switch (iso) {
                        case IsolationLevel.ReadUncommitted:
@@ -352,9 +349,30 @@
                                isolevel = "SERIALIZABLE";
                                break;
                        case IsolationLevel.ReadCommitted:
-                       default:
                                isolevel = "READ COMMITTED";
                                break;
+#if NET_2_0
+                       case IsolationLevel.Unspecified:
+                               iso =  IsolationLevel.ReadCommitted;
+                               isolevel = "READ COMMITTED";
+                               break;
+                       case IsolationLevel.Chaos:
+                               throw new ArgumentOutOfRangeException 
("IsolationLevel",
+                                       string.Format 
(CultureInfo.CurrentCulture,
+                                               "The IsolationLevel enumeration 
" +
+                                               "value, {0}, is not supported 
by." +
+                                               "the .Net Framework SqlClient " 
+
+                                               "Data Provider.", (int) iso));
+#endif
+                       default:
+#if NET_2_0
+                               throw new ArgumentOutOfRangeException 
("IsolationLevel",
+                                       string.Format 
(CultureInfo.CurrentCulture,
+                                               "The IsolationLevel enumeration 
value, {0}, is invalid.",
+                                               (int) iso));
+#else
+                               throw new ArgumentException ("Invalid 
IsolationLevel parameter: must be ReadCommitted, ReadUncommitted, 
RepeatableRead, or Serializable.");
+#endif
                        }
 
                        tds.Execute (String.Format ("SET TRANSACTION ISOLATION 
LEVEL {0};BEGIN TRANSACTION {1}", isolevel, transactionName));

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to