解析字符串predicate [英] Parse a string to predicate
问题描述
我试图找出一个解决方案,其中在运行时程序会分析了串,并返回predicate。到目前为止,我所发现的是<一个href="http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx"相对=nofollow> DynamicLinq 类(样品),没有工作。
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.
我想知道 - 是有可能使用的OData LIB能一样吗? 通过在ODATA结构的字符串(颜色='红'和;参数=富),并得到一个LINQ predicate?
I'm wondering - is it possible to use OData lib to the same ? Pass in the "odata" structure string ("?color='red'¶m=foo"), and get a Linq predicate ?
推荐答案
该ODataLib的contrib项目包括类似于你在找什么解析器。它不会产生LINQ predicate然而,它只产生中间AST,但它可能给你的东西从开始。请参见 HTTP://odata.$c$cplex.com/wikipage?标题= ODataLib和放大器; referringTitle =主页(该库可作为在codePLEX或作为的NuGet包的 http://nuget.org/packages/Microsoft.Data.OData.Contrib )
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)
这篇关于解析字符串predicate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!