[Mono-bugs] [Bug 77785][Nor] Changed - SQLServerSessionState cannot update session when the connection is closed by the server

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Mar 15 03:07:30 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by robertj at gmx.net.

http://bugzilla.ximian.com/show_bug.cgi?id=77785

--- shadow/77785	2006-03-15 03:06:21.000000000 -0500
+++ shadow/77785.tmp.14951	2006-03-15 03:07:30.000000000 -0500
@@ -214,6 +214,44 @@
 So, we MUST check in SQLSessionHandler the "real" connection state 
 
 ------- Additional Comments From robertj at gmx.net  2006-03-15 03:06 -------
 Gonzalo, this can't be fixed in System.Data. It's SQLServerSessionState
 which doesn't check the connection state.
 
+
+------- Additional Comments From robertj at gmx.net  2006-03-15 03:07 -------
+Hubert, you're right that this has to be eventually fixed
+in SessionSQLServerHandler, but your patch is horrible.
+Please implement 2 methods that check the connection
+state and use them in place of the copy&paste patch:
+
+void ExecuteNonQuery ()
+{
+    try {
+        if (cnc.State == ConnectionState.Closed)
+            cnc.Open ();
+        cnc.ExecuteNonQuery ();
+    } catch {
+        cnc.Open ();
+        cnc.ExecuteNonQuery ();
+    }
+}
+
+IDataReader ExecuteReader ()
+{
+    try {
+        if (cnc.State == ConnectionState.Closed)
+            cnc.Open ();
+        return cnc.ExecuteReader ();
+    } catch {
+        cnc.Open ();
+        return cnc.ExecuteReader ();
+    }
+}
+
+
+We probably should use the "pooled connection pattern",
+but since the connection has to be activated via
+reflection, it would introduce some overhead on every
+request. It's a shame how M$ did design the session
+state :-/
+


More information about the mono-bugs mailing list