Skip to content

Make filtering extensible #77

Closed
Closed
@jaredcnance

Description

@jaredcnance

Proposed by @jfhs:

I think, filter query params could be simple parsed to triplets like <key,value,operation> (as you have it now, but key and operation would be an arbitrary string). Then to support attribute filtering out of the box, in DefaultRepository.Filter check if filter key is a valid attribute, and operation is supported, then construct new FilterQuery and pass it to IQueryable.Filter
this way you can keep filtering code for EF
and then if user wants to have custom filters - he just have to override Repository.Filter and handle his custom filters before default.
and pass everything else to base class

Proposal

  • Rename FilterQuery to AttrFilterQuery
  • Create new FilterQuery with raw request (string) information
  • AttrFilterQuery accepts FilterQuery as a constructor parameter and the attribute mapping in QuerySet should be moved here
  • DefaultEntityRepository constructs AttrFilterQuery from FilterQuery
  • Document override procedure

Breaking Changes

  • The FilterQuery class is changing and could affect custom implementations of IEntityRepository

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions