Skip to content

Support multiple properties with OR in single filter reference #279

@derSchtefan

Description

@derSchtefan

Details

We have the issue that a search for a single term should look up multiple properties with an OR chain. (With EF Core and SQL Server)

Suppose there is a Course Entity, and it has related Student entities via a navigation, and the properties to be looked in are the student key, their name, etc. We have to currently hard code this into the front end, so if somebody is searching in the "Student" field, we have to send students.key=*xyz|students.name=*xyz and add this to the mapper in the backend:

 var mapper = new GridifyMapper<Course>(true)
        .AddMap("students.key", task => task.StudentAssignments.Select(row => row.StudentKey))
        .AddMap("students.name", task => task.StudentAssignments.Select(row => row.StudentKeyNavigation.Name));

We would rather simply send students=*xyz, and have the backend look in multiple properties, which are all OR chained, like this:

 var mapper = new GridifyMapper<Course>(true)
        .AddMultipleMap("students",
task => task.StudentAssignments.Select(row => row.StudentKey)),
task => task.StudentAssignments.Select(row => row.StudentKeyNavigation.Name));

with AddMultipleMap taking a string, and a params[] of expressions that are chained in ORs.

We have not found a way of implementing this elegantly, we even considered parsing the filter expression, but running through the syntax tree seemed a bit extreme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions