/// <summary> /// Initializes a new instance of the <see cref="QueryCommand"/> class. /// </summary> /// <param name="sql">The SQL.</param> /// <param name="provider">The provider.</param> public QueryCommand(string sql, IDataProvider provider) { CommandSql = sql; CommandType = CommandType.Text; parameters = new QueryParameterCollection(); OutputValues = new List <object>(); Provider = provider; }
/// <summary> /// Adds the parameter. The public AddParameter methods should call this one. /// </summary> /// <param name="parameterName">ColumnName of the parameter.</param> /// <param name="parameterValue">The parameter value.</param> /// <param name="maxSize">Size of the max.</param> /// <param name="dbType">Type of the db.</param> /// <param name="direction">The direction.</param> private void AddParameter(string parameterName, object parameterValue, int maxSize, DbType dbType, ParameterDirection direction) { if (parameters == null) { parameters = new QueryParameterCollection(); } QueryParameter param = new QueryParameter { ParameterName = parameterName, ParameterValue = (parameterValue ?? DBNull.Value), Mode = direction, DataType = dbType }; if (maxSize > -1 && direction != ParameterDirection.Output) { param.Size = maxSize; } parameters.Add(param); }