protected void DoBeforeExecuteCommand(DbCommand command) { if (BeforeExecuteCommand != null) { var args = new CommandExecuteEventArgs(command); BeforeExecuteCommand(this, args); if (args.Cancel) { throw new OperationCanceledException("Command Execution Canceled"); } } }
private int ExecuteNonQueryInternal(DbCommand command) { SetCommandTimeout(command); DbTransactionRegistry.SetCommandTransaction(command); if (BeforeExecuteCommand != null) { var args = new CommandExecuteEventArgs(command); BeforeExecuteCommand(this, args); if (args.Cancel) { throw new OperationCanceledException("Command Execution Canceled"); } } return(command.ExecuteNonQuery()); }
private DbDataReader ExecuteReaderInternal(DbCommand command, CommandBehavior behavior) { SetCommandTimeout(command); DbTransactionRegistry.SetCommandTransaction(command); if (BeforeExecuteCommand != null) { var args = new CommandExecuteEventArgs(command); BeforeExecuteCommand(this, args); if (args.Cancel) { throw new OperationCanceledException("Command Execution Canceled"); } } return(command.ExecuteReader(behavior)); }