The basic idea is to take a string and evaluate it against an XML File (or any LINQed provider)
I found this LINQ Dynamic Query Library. Just had a cursory glance at the documentation which is a single page in the download bundle. This seems to be adding extension methods to parameterize parts of the LINQ Query. Does anyone know if this does dynamic evaluation?
Is there any way to just do (assuming there is some way to seed the class with the Data from the XML File) ?
ClassFromWishfulThinking.Evaluate(sLinqQuery);
The Dynamic LINQ library let you execute query with dynamic string and provide some utilities methods such as ParseLambda , Parse , and CreateClass .
LINQ can be used to query and transform strings and collections of strings. It can be especially useful with semi-structured data in text files. LINQ queries can be combined with traditional string functions and regular expressions. For example, you can use the String.
The Dynamic LINQ library exposes a set of extension methods on IQueryable corresponding to the standard LINQ methods at Queryable, and which accept strings in a special syntax instead of expression trees.
It must be possible because Linqpad does it!
Looking at the how it works page is a bit mind bending, and I'm not sure this is something you would want to do with production code unless you really couldn't avoid it.
There is no framework method that just does what you want, I can say that with a fairly high degree of confidence because of how .net works. You have to call the compiler using the csharpcodeprovider as LinqPad does.
You might be able to change the Linq Dynamic Query Library to do what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With