I'm creating a reporting engine. One of my challenges in trying to make it more generic is trying to figure out how to give users more flexibility in their queries, meaning generate their own for later use rather than using a fixed set provided by me.
For example, say I have a Document object which has N Section objects which has N Line objects.
In code with more static goals, I can easily get a list of Documents where there is a Section that has a Line which has a value containing some text using a where clause on a list of Documents and a lambda expression.
However, there are a lot (almost infinite) possible expressions, so limiting people to a subset or having to encode every possible path as a parametrized method is not really viable.
So the question is, how do I 1) Construct a lambda expression from string data (meaning how can I effectively POST to the server some data which I can flexibly convert to the expression) and 2) how can I save that expression for later use in a DB?
Probably only #1 is really relevant since if I can construct the expression when POST data that I can store that string info to the DB and do the same process, but I currently have no idea how to accomplish #1
Any suggestions? I feel like this is a workable thing in theory but I'm clearly missing the basic approach.