I have the requirement that users should be able to specify filter conditions for one kind of entity through a GUI on a thin client. These conditions must be
- convenient to generate, meaning the GUI should guide users as much as possible. They shouldn't have to write SQL or anything.
- stored with a time stamp, a user ID, a description, and whatnot...
- loaded and edited
- reusable by other users
- used for loading matching entities from the DB via an ORM framework. Ideally I could generate a predicate out of them - SQL or maybe an Expression, which the ORM can translate to SQL
In my case users specify a condition for customers, for who invoices should be generated. There will be many different such "customer selections".
I think the specification pattern might be a good match, but couldn't find any examples, where specifications are built through a GUI, serialized and stored/reloaded/edited via an app server and used to retrieve matching entities.
Am I maybe overlooking the standard way to do such a thing? Colleagues have suggested to just build the SQL WHERE predicate on client side, but I don't like that. The client shouldn't know that much about persistence (column names...), and should only be allowed to use certain predicates, but not others. Also I'd have to parse these strings into separate predicates when I reload a condition to display them in a user friendly way.