/// <summary> /// Returns the hash code for the command /// </summary> /// <returns>The hash code for the object</returns> public override int GetHashCode() { unchecked { int ParameterTotal = 0; foreach (IParameter TempParameter in Parameters) { ParameterTotal += TempParameter.GetHashCode(); } if (ParameterTotal > 0) { return((SQLCommand.GetHashCode() * 23 + CommandType.GetHashCode()) * 23 + ParameterTotal); } return(SQLCommand.GetHashCode() * 23 + CommandType.GetHashCode()); } }
private void SetupParameters(ref int Count, List <IParameter> FinalParameters, ref bool Finalizable, ref string FinalSQLCommand, ref int ParameterTotal) { for (int y = Count; y < Commands.Count; ++y) { ICommand Command = Commands[y]; if (ParameterTotal + Command.Parameters.Count > 2100) { break; } ParameterTotal += Command.Parameters.Count; Finalizable |= Commands[y].Finalizable; if (Command.CommandType == CommandType.Text) { var TempCommandText = Command.SQLCommand ?? ""; string Suffix = "Command" + Count.ToString(CultureInfo.InvariantCulture); FinalSQLCommand += string.IsNullOrEmpty(Command.SQLCommand) ? "" : ParameterRegex.Replace(Command.SQLCommand, x => { var Param = Command.Parameters.FirstOrDefault(z => z.ID == x.Groups["ParamName"].Value); if (Param != null) { return(x.Value + Suffix); } return(x.Value); }) + Environment.NewLine; foreach (IParameter TempParameter in Command.Parameters) { FinalParameters.Add(TempParameter.CreateCopy(Suffix)); } } else { FinalSQLCommand += Command.SQLCommand + Environment.NewLine; foreach (IParameter TempParameter in Command.Parameters) { FinalParameters.Add(TempParameter.CreateCopy("")); } } ++Count; } }