1

I want to build a gui panel/wizard where my application's users could build custom conditions/expressions using the properties of a strongly typed object model. Basically something like this.

The structure could be nested (LHS/RHS might consist of other expressions) and combined with other expressions using or/and/foreach operands.

I want to be able to check for correct types and values for each sub-expression. Ideally the final query should be a linq query or an expression tree.

My goal is to let users design their own strategies or simple workflows.

What type you would suggest for handling the expressions and what solution for creating the dynamic query?

I am thinking representing the expressions as strings e.g.

person.DateOfBirth > 1970 && person.Country != Country.Germany

and then create the linq query using the concatenation as parameter in the extended .Where clause produced by the Dynamic LINQ library as described here.

Is it possible to create dynamically advanced expression or there are limitations on this solution?

What alternative solutions do you suggest?

1 Answer 1

2

Check LINQKit project especially PredicateBuilder class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.