How do I programmatically translate a LINQ query to readable English text that correctly describes t

Posted by eniac on Stack Overflow See other posts from Stack Overflow or by eniac
Published on 2010-06-08T16:27:38Z Indexed on 2010/06/08 18:12 UTC
Read the original article Hit count: 279

Filed under:
|
|

I am working on a project that uses Albahari's PredicateBuilder library http://www.albahari.com/nutshell/ to create a linq expression dynamically at run time. I would like to find a way to translate this dynamically created linq predicate of type Expression<Func<T, bool>> into a readable english statement at runtime.

I'll give a statically created linq statement as an example:

from p in Purchases
select p
where p.Price > 100 && p.Description != "Bike".

For this linq statement I would want to dynamically generate at runtime an english description along the lines of:

"You are searching for purchases where the price is greater than 100 and the description is not bike".

Are there any libraries that already exist which accomplish this goal, keep in mind I am using PredicateBuilder to dynamically generate the where predicate. If no solution exists how would you go about building a solution?

Thanks!

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about c#3.0