/// <summary>
        /// Adds a new <see cref="QueryParameter"/> to the collection.
        /// </summary>
        /// <param name="parameterName">The <see cref="QueryParameter.Name"/> of the new parameter. Must not be <see langword="null"/>.</param>
        /// <param name="parameterValue">The <see cref="QueryParameter.Value"/> of the new parameter.</param>
        /// <param name="parameterType">The <see cref="QueryParameterType"/> of the new parameter.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="parameterName"/> is <see langword="null"/>.</exception>
        /// <exception cref="System.ArgumentException"><paramref name="parameterName"/> is an empty string.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="parameterType"/> is not a valid enum value.</exception>
        public void Add(string parameterName, object parameterValue, QueryParameterType parameterType)
        {
            ArgumentUtility.CheckNotNullOrEmpty("parameterName", parameterName);
            ArgumentUtility.CheckValidEnumValue("parameterType", parameterType);

            Add(new QueryParameter(parameterName, parameterValue, parameterType));
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryParameter"/> class.
        /// </summary>
        /// <param name="name">The name of the parameter. Must not be <see langword="null"/>.</param>
        /// <param name="value">The value of the parameter.</param>
        /// <param name="parameterType">The <see cref="QueryParameterType"/> of the parameter.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="name"/> is <see langword="null"/>.</exception>
        /// <exception cref="System.ArgumentException"><paramref name="name"/> is an empty string.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="parameterType"/> is not a valid enum value.</exception>
        public QueryParameter(string name, object value, QueryParameterType parameterType)
        {
            ArgumentUtility.CheckNotNullOrEmpty("name", name);
            ArgumentUtility.CheckValidEnumValue("parameterType", parameterType);

            _name          = name;
            _value         = value;
            _parameterType = parameterType;
        }
 private void SetParameterType(string parameterLine)
 {
     if (parameterLine.Contains(StringDelimiter))
     {
         Type = QueryParameterType.String;
     }
     else if (parameterLine.Contains(DateDelimiter))
     {
         Type = QueryParameterType.Date;
     }
     else if (parameterLine.Contains(BooleanDelimiter))
     {
         Type = QueryParameterType.Boolean;
     }
     else if (parameterLine.Contains(BigdecimalDelimiter))
     {
         Type = QueryParameterType.BigDecimal;
     }
     else
     {
         throw new ApplicationException($"Unknown parameter type: {parameterLine}");
     }
 }
 public ScalarQueryParameter WithType(QueryParameterType type)
 {
     return(new ScalarQueryParameter(Title, type, Position));
 }
 private ScalarQueryParameter(string title, QueryParameterType type, short position)
 {
     Title    = title;
     Type     = type;
     Position = position;
 }
示例#6
0
 /// <summary>
 /// Конструктор по умолчанию, принимающий имя параметра строки запроса.
 /// </summary>
 /// <param name="parameterType">Тип параметра.</param>
 public QueryParameterAttribute(QueryParameterType parameterType) => ParameterType = parameterType;