/// <summary> /// This is required because SqlClient.SqlCommandSet will throw if /// the command has no parameters. /// </summary> /// <param name="command"></param> private static void AssertHasParameters(SqlCommand command) { if (command.Parameters.Count == 0) { throw new ArgumentException("A command in SqlCommandSet must have parameters. You can't pass hardcoded sql strings."); } }
/// <summary> /// Append a command to the batch /// </summary> /// <param name="command"></param> public void Append(SqlCommand command) { AssertHasParameters(command); doAppend(command); countOfCommands++; }
public ProfiledSqlDbCommand(SqlCommand cmd, SqlConnection conn, MiniProfiler profiler) : base(cmd, conn, profiler) { Command = cmd; }