I have a set of some clients that I am using for some clients for data access layers. As part of data access, I am sending a set of filters in this format:
"{member [.mail ....]} {operator} {value}" I would like to convert these stars into delegates for use in a LINQ query:
. Where ([delegates come back by a factory]) Here is a more concrete example:
IEnumerable & lt; Parent & gt; Parents = GetSomeParents (); String filter = "child.id = 5"; Var expression = filterfibrator & lt; Parent & gt; .GETExpression (filter); Parents = Parents Where (expression); The expression will include a representative: parent = & gt; Parents.Little.ID == 5 Is there a way in which I send the path of any member, using reflections to make a filter filter in a normal way to handle it Am I Path is not required with indexing, but it would be nice.
Yes of course! To do this is really a fun thing.
In a way you can do this and use it to get expression compiler. I have some very similar in my project.
But if you do not get the syntax or features also what you want, you can do it, but you can do it yourself too. The general idea is that you need to parse the string and construct the expression tree that you represent parsing. Expression tree objects in NET can be found in System.Linq.Expressions. Once you can compile it after your tree and it will be dynamically compiled into a rep, then
PS will not recommend using regular expressions / html>
Comments
Post a Comment