Table of Contents

Class Filter

Namespace
GroupeIsa.Neos.Application.Filters
Assembly
GroupeIsa.Neos.Application.Abstractions.dll

Represents the filter of a property.

[JsonConverter(typeof(FilterJsonConverter))]
public class Filter : ICloneable
Inheritance
Filter
Implements
Inherited Members

Constructors

Filter()

Initializes a new instance of the Filter class.

public Filter()

Filter(FilterCondition)

Initializes a new instance of the Filter class.

public Filter(FilterCondition condition)

Parameters

condition FilterCondition

Filter condition.

Filter(FilterCondition?, FilterLogicalOperator, params Filter[])

Initializes a new instance of the Filter class.

public Filter(FilterCondition? condition, FilterLogicalOperator logicalOperator, params Filter[] children)

Parameters

condition FilterCondition

Filter condition.

logicalOperator FilterLogicalOperator

Filter operator logical.

children Filter[]

Children filter collection.

Filter(params Filter[])

Initializes a new instance of the Filter class.

public Filter(params Filter[] children)

Parameters

children Filter[]

Children filter collection.

Filter(string, FilterOperator, params object?[])

Initializes a new instance of the Filter class.

public Filter(string propertyPath, FilterOperator filterOperator, params object?[] values)

Parameters

propertyPath string

Property path.

filterOperator FilterOperator

Condition operator.

values object[]

Value of the filter condition.

Properties

Children

Gets a children filter collection.

public IEnumerable<Filter> Children { get; }

Property Value

IEnumerable<Filter>

Condition

Gets or sets the filter condition.

public FilterCondition? Condition { get; set; }

Property Value

FilterCondition

IsCondition

Gets a value indicating whether if the filter is a condition.

public bool IsCondition { get; }

Property Value

bool

IsEmpty

Gets a value indicating whether if the filter is empty.

public bool IsEmpty { get; }

Property Value

bool

IsSimple

Gets a value indicating whether if the filter is composed of only condition filters linked by the "And" operator for all filters.

public bool IsSimple { get; }

Property Value

bool

LogicalOperator

Gets the filter logical operator.

public FilterLogicalOperator LogicalOperator { get; }

Property Value

FilterLogicalOperator

Methods

Add(Filter)

Adds the specified filter to the children of this filter.

public Filter Add(Filter filter)

Parameters

filter Filter

The filter to add.

Returns

Filter

Return the filter with the specified filter added.

Clear()

Removes all filters from the filter.

public void Clear()

Clone()

Creates a shallow copy of the filter.

public object Clone()

Returns

object

A shallow copy of the filter.

ConvertFromJson(string)

Converts from JSON.

public static Filter ConvertFromJson(string value)

Parameters

value string

Value.

Returns

Filter

A new instance of the Filter class.

ConvertToJson()

Converts to JSON.

public string ConvertToJson()

Returns

string

string representation.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Expand(FilterLogicalOperator?)

Expands a filter.

This filter becomes a child.

public void Expand(FilterLogicalOperator? logicalOperator = null)

Parameters

logicalOperator FilterLogicalOperator?

The logical operator.

Examples

The following example shows how to build the filter : ShipCountry = 'France' or ShipCountry = 'Spain'.

  var filter = new Filter("ShipCountry", FilterOperator.Equal, "France");
                                                                                                                               filter.Expand(FilterLogicalOperator.Or);
                                                                                                                               filter.Add(new Filter("ShipCountry", FilterOperator.Equal, "Spain"));

Find(string)

Returns the first filter found whose property path is the specified property path.

public Filter? Find(string propertyPath)

Parameters

propertyPath string

Property path.

Returns

Filter

The first filter found whose property path is the specified property path.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Join(Filter, FilterLogicalOperator)

Joins the specified filter to this filter with the specified operator.

public Filter Join(Filter filter, FilterLogicalOperator logicalOperator)

Parameters

filter Filter

The filter to add.

logicalOperator FilterLogicalOperator

The logical operator.

Returns

Filter

Return the filter with the specified filter added.

Remove(Filter)

Removes a specific filter recursively.

public bool Remove(Filter filter)

Parameters

filter Filter

The filter to remove.

Returns

bool

Return true if removes a specific filter recursively.

ToODataString()

Converts the filter to OData string.

public string ToODataString()

Returns

string

The OData string.

Exceptions

NotSupportedException

When the filter cannot be converted.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToText()

Converts to human readable text.

public string? ToText()

Returns

string

A human readable text.