private static void OnConnectionOpened(object sender, ConnectionEventArgs e) {
     // Register all open connections for disposing at the end of the request
     HttpContext httpContext = HttpContext.Current;
     if (httpContext != null) {
         HttpContextWrapper httpContextWrapper = new HttpContextWrapper(httpContext);
         httpContextWrapper.RegisterForDispose(e.Connection);
     }
 }
Пример #2
0
		public void InstantiateTest ()
		{
			var evtArgs = new ConnectionEventArgs (null);
			Assert.IsNull (evtArgs.Connection, "#1");

			var conn = new SqlConnection ();
			evtArgs = new ConnectionEventArgs (conn);
			Assert.AreEqual (conn, evtArgs.Connection, "#2");
		}