Query parameters for one prop module.
Inheritance: QueryParameters
 /// <summary>
 /// Returns a copy of current instance with <see cref="OnlyFirst"/> set to <c>true</c>.
 /// </summary>
 /// <returns></returns>
 public PropQueryParameters WithOnlyFirst()
 {
     var result = new PropQueryParameters(PropName);
     CopyTo(result);
     result.OnlyFirst = true;
     return result;
 }
Beispiel #2
0
        /// <summary>
        /// Returns a copy of current instance with <see cref="OnlyFirst"/> set to <c>true</c>.
        /// </summary>
        /// <returns></returns>
        public PropQueryParameters WithOnlyFirst()
        {
            var result = new PropQueryParameters(PropName);

            CopyTo(result);
            result.OnlyFirst = true;
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Returns a copy of current instance with <see cref="QueryParameters.Properties"/> set.
        /// </summary>
        public PropQueryParameters WithProperties(IEnumerable <string> properties)
        {
            var result = new PropQueryParameters(PropName);

            CopyTo(result);
            result.Properties = properties;
            return(result);
        }
        /// <summary>
        /// Adds a single name-value pair to the current query and returns the result.
        /// The parameter <paramref name="value"/> can actually represent multiple values.
        /// </summary>
        public PropQueryParameters AddSingleValue(string name, string value)
        {
            if (value == null)
                return this;

            if (Value != null && Value.Any(v => v.Name == name))
                throw new InvalidOperationException(
                    string.Format("Tried adding value with the name '{0}' that is already present.", name));

            var result = new PropQueryParameters(PropName);
            CopyTo(result);

            result.Value = new NameValueParameter(Value, name, value);
            return result;
        }
Beispiel #5
0
        /// <summary>
        /// Adds a single name-value pair to the current query and returns the result.
        /// The parameter <see cref="value"/> can actually represent multiple values.
        /// </summary>
        public PropQueryParameters AddSingleValue(string name, string value)
        {
            if (value == null)
            {
                return(this);
            }

            if (Value != null && Value.Any(v => v.Name == name))
            {
                throw new InvalidOperationException(
                          string.Format("Tried adding value with the name '{0}' that is already present.", name));
            }

            var result = new PropQueryParameters(PropName);

            CopyTo(result);

            result.Value = new NameValueParameter(Value, name, value);
            return(result);
        }
 /// <summary>
 /// Returns a copy of current instance with <see cref="QueryParameters.Properties"/> set.
 /// </summary>
 public PropQueryParameters WithProperties(IEnumerable<string> properties)
 {
     var result = new PropQueryParameters(PropName);
     CopyTo(result);
     result.Properties = properties;
     return result;
 }