protected internal void InnerFreeupResources(bool commit) { string errorMessage = ""; Exception lastException = null; foreach (IDatabaseAccessProvider provider in dbConnectionProviders.Values.Cast <IDatabaseAccessProvider>().Concat(databaseProviders.Values.Cast <IDatabaseAccessProvider>())) { try { provider.FreeupResources(commit); } catch (Exception e) { commit = false; lastException = e; string error = String.Format("Error closing the transaction to the database: {0}\n{1}\n{2}", e.Message, e.StackTrace, new StackTrace(true)); EventLogger.WriteError(error); errorMessage = String.Format("{0}\n{1}", errorMessage, error); } } try { SystemProvider.FreeupResources(commit); } catch (Exception e) { lastException = e; string error = String.Format("Error closing the transaction to the database: {0}\n{1}\n{2}", e.Message, e.StackTrace, new StackTrace(true)); EventLogger.WriteError(error); errorMessage = String.Format("{0}\n{1}", errorMessage, error); } if (errorMessage != "") { throw new TransactionException(errorMessage, lastException); } }