Dynamic Linq expression generator

Some time ago I read this post that speaks about dynamic query library. I downloaded the code sample, it is interesting, but is bound to Linq to Sql, now I need an implementation of a Dynamic Linq Query generator. Since I already worked in the past with expression parser and I have some generic Infix to postfix converter in a three hours of work I was able to put everything in a project and now I can write

1
2
Func<Customer, Boolean> f = DynamicLinq.ParseToFunction<Customer, Boolean>("Name == 'Gian Maria'");
Assert.That(f(aCustomer), Is.True);

This example shows that I can build a simple function that accepts an entity (Customer) and a string representing some conditions, then I’m able to dynamically parse the string, create an expression tree and call Compile on it to obtain a function that I can use in code. As soon as possible I’ll show a complete example if you are interested in.

alk.

Tags: LINQ Dynamic Expression Generation