Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse a string to predicate

I'm trying to work out a solution, where at runtime a procedure would parse a "string" and return a predicate. so far what I've found is DynamicLinq class (sample) that does the job.

I'm wondering - is it possible to use OData lib to the same ? Pass in the "odata" structure string ("?color='red'&param=foo"), and get a Linq predicate ?

like image 653
Marty Avatar asked Nov 13 '22 02:11

Marty


1 Answers

The ODataLib contrib project includes a parser similar to what you're looking for. It's doesn't produce the LINQ predicate yet, it only produces intermediate AST, but it might give you something to start from. See http://odata.codeplex.com/wikipage?title=ODataLib&referringTitle=Home (the library is available as a source code on the codeplex or as a nuget package http://nuget.org/packages/Microsoft.Data.OData.Contrib)

like image 95
Vitek Karas MSFT Avatar answered Dec 16 '22 12:12

Vitek Karas MSFT