Exemplo n.º 1
0
 public void AddAttributeExclusionFilters(string[] exclusionFilters)
 {
     if (exclusionFilters == null)
     {
         return;
     }
     foreach (var exlusionFilter in exclusionFilters.Where(x => x != null))
     {
         var filter = exlusionFilter.ValidateAndEscape().WrapWithAnchors();
         ExcludedAttributes.Add(new Lazy <Regex>(() => new Regex(filter)));
     }
 }
        public string ToJson()
        {
            var obj = new JObject();

            if (Attributes != null && Attributes.Any())
            {
                obj[Common.Constants.SearchParameterNames.Attributes] = new JArray(Attributes);
            }

            if (ExcludedAttributes != null && ExcludedAttributes.Any())
            {
                obj[Common.Constants.SearchParameterNames.ExcludedAttributes] = new JArray(ExcludedAttributes);
            }

            if (!string.IsNullOrEmpty(Filter))
            {
                obj[Common.Constants.SearchParameterNames.Filter] = Filter;
            }

            if (!string.IsNullOrEmpty(SortBy))
            {
                obj[Common.Constants.SearchParameterNames.SortBy] = SortBy;
            }

            if (SortOrder != null)
            {
                obj[Common.Constants.SearchParameterNames.SortOrder] = SortOrder == SortOrders.Ascending
                    ? Common.Constants.SortOrderNames.Ascending
                    : Common.Constants.SortOrderNames.Descending;
            }

            if (StartIndex != null)
            {
                obj[Common.Constants.SearchParameterNames.StartIndex] = StartIndex;
            }

            if (Count != null)
            {
                obj[Common.Constants.SearchParameterNames.Count] = Count;
            }

            return(obj.ToString());
        }
Exemplo n.º 3
0
 public void AddAttributeExclusionFilters(string[] exclusionFilters)
 {
     ExcludedAttributes.AddFilters(exclusionFilters, RegExFilters);
 }