开发者

parse delegate to string query c#.net

I want to implement simple LINQ-to-SQL-like functionality in m开发者_如何学Cy .net application. For example i have the following code:

userAccounts.Where(ua=>ua.Name=="User1");

and i want delegate in Where method to create a string like this

"name = 'User1'".

How it can be done?

Thanks.


The solution you are looking for is called Expression Tree Visitor.

See this blog on how to parse and visualize the query's .Expression property

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜