FilterRule.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using System.Diagnostics.CodeAnalysis;
  3. namespace Vit.Linq.QueryBuilder
  4. {
  5. /// <summary>
  6. /// This class is used to define a hierarchical filter for a given collection. This type can be serialized/deserialized by JSON.NET without needing to modify the data structure from QueryBuilder.
  7. /// </summary>
  8. [ExcludeFromCodeCoverage]
  9. public class FilterRule : IFilterRule
  10. {
  11. /// <summary>
  12. /// condition - acceptable values are "and" and "or".
  13. /// </summary>
  14. public string condition { get; set; }
  15. public string field { get; set; }
  16. public string @operator { get; set; }
  17. /// <summary>
  18. /// nested filter rules.
  19. /// </summary>
  20. public List<FilterRule> rules { get; set; }
  21. /// <summary>
  22. /// Gets or sets the value of the filter.
  23. /// </summary>
  24. /// <value>
  25. /// The value.
  26. /// </value>
  27. public object value { get; set; }
  28. IEnumerable<IFilterRule> IFilterRule.rules => rules;
  29. }
  30. }