Table of Contents

Class EntityFilter

Namespace
Arbiter.CommandQuery.Queries
Assembly
Arbiter.CommandQuery.dll

Represents a filter for selecting entities based on specific criteria.

[JsonConverter(typeof(EntityFilterConverter))]
public class EntityFilter
Inheritance
EntityFilter
Inherited Members

Examples

The following example demonstrates how to use the EntityFilter class as a basic filter:

var filter = new EntityFilter
{
    Name = "Status",
    Operator = "eq",
    Value = "Active"
};

The following example demonstrates how to use the EntityFilter class as group filter:

var filter = new EntityFilter
{
    Logic = "and",
    Filters = new List<EntityFilter>
    {
        new EntityFilter { Name = "Priority", Operator = "gt", Value = 1 },
        new EntityFilter { Name = "Status", Operator = "eq", Value = "Active" }
    }
};

Remarks

This class is typically used in queries to define filtering criteria for entities. Filters can be combined using logical operators such as "and" or "or" and can include nested filters for complex queries.

Properties

Filters

Gets or sets the list of nested filters to apply to the query. The logic for these filters is defined by the Logic property.

[JsonPropertyName("filters")]
public IList<EntityFilter>? Filters { get; set; }

Property Value

IList<EntityFilter>

The list of nested filters to apply to the query.

Logic

Gets or sets the logical operator to use for combining filters. This can be "and" or "or".

[JsonPropertyName("logic")]
public string? Logic { get; set; }

Property Value

string

The logical operator to use for combining filters.

See Also

Name

Gets or sets the name of the field or property to filter on.

[JsonPropertyName("name")]
public string? Name { get; set; }

Property Value

string

The name of the field or property to filter on.

Operator

Gets or sets the operator to use for the filter. This can be "eq" (equals), "ne" (not equals), "gt" (greater than), "lt" (less than), "ge" (greater than or equal), "le" (less than or equal), "contains", "startswith", or "endswith".

[JsonPropertyName("operator")]
public string? Operator { get; set; }

Property Value

string

The operator to use for the filter.

See Also

Value

Gets or sets the value to filter on.

[JsonPropertyName("value")]
public object? Value { get; set; }

Property Value

object

The value to filter on.

Methods

GetHashCode()

Computes the hash code for the current EntityFilter instance.

public override int GetHashCode()

Returns

int

A hash code for the current EntityFilter instance.

IsValid()

Determines whether this filter is valid. A filter is considered valid if it has a name or if it contains a list of valid nested filters.

public bool IsValid()

Returns

bool

true if the filter is valid; otherwise, false.