protected override IList ResolveTypedValue(string orderByQueryString, IList sortSpecs) { string[] specs = orderByQueryString.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string spec in specs) { Match match = SpecPattern.Match(spec); if (!match.Success) { Error($"Invalid format - '{spec}'. Should be of the form '<field> [asc|desc]'."); } string fieldName = match.Groups[1].Value; string sortOrder = string.IsNullOrWhiteSpace(match.Groups[2].Value) ? "asc" : match.Groups[2].Value; sortSpecs.Add(CreateSortSpec(fieldName, sortOrder)); } return(sortSpecs); }
protected override IList ResolveTypedValue(string filterQueryString, IList filters) { string[] specs = filterQueryString.Split(new[] { " and " }, StringSplitOptions.RemoveEmptyEntries); foreach (string spec in specs) { Match match = SpecPattern.Match(spec); if (!match.Success) { Error($"Invalid format - '{spec}'. Should be of the form '<field> <eq|ne|gt|ge|lt|le|lk> <value>'."); } string fieldName = match.Groups[1].Value; string operand = match.Groups[2].Value; string value = match.Groups[3].Value; filters.Add(CreateFilterCriteria(fieldName, operand, value)); } return(filters); }