public int ExecuteNonQuery(string description, bool isApplication, bool skipLog, bool applyTransformationsToParameters) { DateTime startTime = DateTime.Now; IDbTransaction trans = DriverCommand.Transaction; IDbConnection conn = DriverCommand.Connection; int result; try { if (applyTransformationsToParameters) { TransformParametersSyntax(); } Func <int> executeNonQuery = () => { return(ExecutionService.ExecuteNonQuery(DriverCommand)); }; result = DatabaseBehaviours.ExecuteWithoutRequestTimeout(executeNonQuery); IEnumerable parameters = DriverCommand.Parameters; foreach (IDbDataParameter parameter in parameters) { if (IsOutputParameter(parameter.Direction)) { parameter.Value = ExecutionService.TransformDatabaseToRuntimeValue(parameter.Value); } } } catch (DbException e) { HandleDatabaseException(e, null, conn, trans); throw; } if (!skipLog) { LogSlowQuery(startTime, description, isApplication); } return(result); }
protected override void EndTransaction(TransactionInfo transInfo, bool commit, bool toFreeResources) { //Keep the request transaction open if possible if (!toFreeResources && RequestTransactionInfo != null && RequestTransactionInfo.Equals(transInfo)) { IDbCommand cmd = ExecutionService.CreateCommand(transInfo.Transaction, commit ? "COMMIT" : "ROLLBACK"); try { ExecutionService.ExecuteNonQuery(cmd); } catch (DbException e) { ExecutionService.OnExecuteException(e, cmd, null, transInfo.Connection, transInfo.Transaction, this); throw; } } else { base.EndTransaction(transInfo, commit, toFreeResources); } }