开发者

Creating a string from a lambda expression

开发者 https://www.devze.com 2023-01-08 16:31 出处:网络
I have functions that take SQL where clauses, and I\'m wondering if there\'s a way to make them all strongly typed. 开发者_运维技巧 Is there a way to take a lambda expression like a => a.AgencyID == i

I have functions that take SQL where clauses, and I'm wondering if there's a way to make them all strongly typed. 开发者_运维技巧 Is there a way to take a lambda expression like a => a.AgencyID == id and convert it to a string where clause? Like "AgencyID = 'idValue'"?

Thanks!


You could turn the lambda function into an expression tree, and then traverse the tree to build your string.

0

精彩评论

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