/// <summary> /// Selects from feedback based on the feedback id. /// SQL+ Routine: dbo.FeedbackTable - Authored by Alan Hyneman /// </summary> public FeedbackTableOutput FeedbackTable(IFeedbackTableInput input, bool bypassValidation = false) { if (!bypassValidation) { if (!input.IsValid()) { throw new ArgumentException("FeedbackTableInput fails validation - use the FeedbackTableInput.IsValid() method prior to passing the input argument to the FeedbackTable method.", "input"); } } FeedbackTableOutput output = new FeedbackTableOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetFeedbackTableCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; FeedbackTableCommand(cmd, output); } return(output); } for (int idx = 0; idx <= retryOptions.RetryIntervals.Count; idx++) { if (idx > 0) { System.Threading.Thread.Sleep(retryOptions.RetryIntervals[idx - 1]); } try { using (SqlConnection cnn = new SqlConnection(connectionString)) using (SqlCommand cmd = GetFeedbackTableCommand(cnn, input)) { cnn.Open(); FeedbackTableCommand(cmd, output); cnn.Close(); } break; } catch (SqlException sqlException) { bool throwException = true; if (retryOptions.TransientErrorNumbers.Contains(sqlException.Number)) { throwException = (idx == retryOptions.RetryIntervals.Count); if (retryOptions.Logger != null) { retryOptions.Logger.Log(sqlException); } } if (throwException) { throw; } } } return(output); }
private void FeedbackTableCommand(SqlCommand cmd, FeedbackTableOutput output) { using (SqlDataReader rdr = cmd.ExecuteReader()) { if (rdr.Read()) { output.ResultData = GetFeedbackTableResultFromReader(rdr); } rdr.Close(); } }