public static void DisposeRegisteredConnections()
        {
            List <SqlConnection> connections = Context.Items[DISPOSE_CONNECTION_KEY] as List <SqlConnection>;

            if (connections != null)
            {
                Context.Items[DISPOSE_CONNECTION_KEY] = null;

                foreach (var connection in connections)
                {
                    try
                    {
                        if (connection.State != ConnectionState.Closed)
                        {
                            GlobalApplication.LogException("Connection was not in a closed state.");
                        }

                        connection.Dispose();
                    }
                    catch {
                        /* don't care, nothing we can do */
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// manually write a message (wrapped in a simple Exception) to our standard exception log
 /// </summary>
 public static void LogException(string message, Exception inner = null)
 {
     if (inner != null)
     {
         GlobalApplication.LogException(new Exception(message, inner));
     }
     else
     {
         GlobalApplication.LogException(message);
     }
 }
 /// <summary>
 /// manually write an exception to our standard exception log
 /// </summary>
 public static void LogException(Exception ex)
 {
     GlobalApplication.LogException(ex);
 }
 /// <summary>
 /// manually write a message (wrapped in a simple Exception) to our standard exception log
 /// </summary>
 public static void LogException(string message)
 {
     GlobalApplication.LogException(message);
 }