Exemplo n.º 1
0
        public SearchParameter(string property, string search, WhereOperation whereOperator)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }
            if (search == null)
            {
                throw new ArgumentNullException(nameof(search));
            }

            Operator      = SearchParameterOperator.Or;
            Property      = property;
            Search        = search;
            WhereOperator = whereOperator;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="fieldName">The name of the field in the database.</param>
        /// <param name="name">The name of the parameter (without @).</param>
        /// <param name="searchOperator">The operator for the parameter.</param>
        /// <param name="value">The value of the parameter.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> or <paramref name="fieldName"/> are set to null or emptry string.</exception>
        /// <exception cref="ArgumentException">Thrown if the parameter name starts with an '@'.</exception>
        public SearchParameter(string fieldName, string name, SearchParameterOperator searchOperator, object value)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (string.IsNullOrEmpty(fieldName))
            {
                throw new ArgumentNullException(nameof(fieldName));
            }
            if (name.Substring(0, 1) == "@")
            {
                throw new ArgumentException("Parameter must not have '@' at the beginning.", nameof(name));
            }

            Name           = name;
            FieldName      = fieldName;
            SearchOperator = searchOperator;
            Value          = value;
        }