I want to create a gui panel or wizard where users may create their own conditions or expressions by leveraging the attributes of a highly typed object model. basically along these lines
Using or/and/foreach operands, the structure may be nested (LHS/RHS might include additional expressions), and coupled with other expressions.
For each sub-expression, I want to be able to verify that the types and values are right. The final query should ideally be an expression tree or a Linq query.
My intention is to allow people create their own basic procedures or tactics.
What approach would you recommend for dealing with expressions, and how would you go about developing a dynamic query?
I'm considering expressing the expressions as strings, like as
person.DateOfBirth > 1970 && person.Country != Country.Germany
and then construct the expanded linq query using the concatenation as a parameter.
as outlined here. clause generated by the Dynamic LINQ library
If this approach has limits, may dynamically advanced expression be created?
What other options do you propose?
Check out the PredicateBuilder class in the LINQKit project.