/// <summary> /// Gets the record by id and the following record by id /// SQL+ Routine: dbo.FeedbackTableMulti - Authored by Alan Hyneman /// </summary> public FeedbackTableMultiOutput FeedbackTableMulti(IFeedbackTableMultiInput input, bool bypassValidation = false) { if (!bypassValidation) { if (!input.IsValid()) { throw new ArgumentException("FeedbackTableMultiInput fails validation - use the FeedbackTableMultiInput.IsValid() method prior to passing the input argument to the FeedbackTableMulti method.", "input"); } } FeedbackTableMultiOutput output = new FeedbackTableMultiOutput(); if (sqlConnection != null) { using (SqlCommand cmd = GetFeedbackTableMultiCommand(sqlConnection, input)) { cmd.Transaction = sqlTransaction; FeedbackTableMultiCommand(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 = GetFeedbackTableMultiCommand(cnn, input)) { cnn.Open(); FeedbackTableMultiCommand(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 FeedbackTableMultiCommand(SqlCommand cmd, FeedbackTableMultiOutput output) { using (SqlDataReader rdr = cmd.ExecuteReader()) { output.ResultData = new List <FeedbackTableMultiResult>(); while (rdr.Read()) { output.ResultData.Add(GetFeedbackTableMultiResultFromReader(rdr)); } rdr.Close(); } }