/// <param name="configuration"></param>
        /// <param name="instructionString">The sort instruction string e.g. "name+asc".</param>
        public QuerySortInstruction(QueryStringConfiguration configuration, string instructionString)
        {
            _configuration = configuration;

            string[] split = instructionString.Split(configuration.SortModifierDelimiters);
            if (split.Length > 2)
            {
                throw new FormatException("The clause '" + instructionString + "' contains more than one modifier delimiter character.");
            }

            FieldName = split[0];

            Direction = split.Length == 1 ? SortDirection.Unspecified : ParseSortDirection(split[1]);
        }
Пример #2
0
        internal QueryFilterInstruction(QueryStringConfiguration configuration, string instructionString)
        {
            _configuration = configuration;
            if (string.IsNullOrEmpty(instructionString))
            {
                throw new ArgumentNullException(nameof(instructionString));
            }

            int operatorIndex = instructionString.IndexOfAny(OPERATOR_CHARS);

            if (operatorIndex == -1)
            {
                throw new ArgumentException("Instruction string does not contain a comparison operator.", nameof(instructionString));
            }

            FieldName = instructionString.Substring(0, operatorIndex);

            string operatorStr = string.Concat(instructionString.Substring(operatorIndex).TakeWhile(c => OPERATOR_CHARS.Contains(c)));

            Operator = ParseComparisonOperator(operatorStr);

            ValueString = instructionString.Substring(operatorIndex + operatorStr.Length);
        }
Пример #3
0
 public QueryStringCollectionQuery([NotNull] QueryStringConfiguration configuration, [NotNull] NameValueCollection query)
 {
     _configuration = configuration;
     AddQueryCollection(query);
 }
Пример #4
0
 public QueryStringCollectionQuery([NotNull] QueryStringConfiguration configuration, [CanBeNull] string query)
 {
     _configuration = configuration;
     AddQueryString(query);
 }
 public QuerySortInstruction(QueryStringConfiguration configuration, string fieldName, string sortDirection)
 {
     _configuration = configuration;
     FieldName      = fieldName;
     Direction      = ParseSortDirection(sortDirection);
 }