开发者

Analyzing a Linq expression

开发者 https://www.devze.com 2023-03-28 17:03 出处:网络
I would like to know if an IQueryable object\'s Expression contains a certain \"Where clause\". For example, given as IQuer开发者_运维技巧yable instance, which could be something like:

I would like to know if an IQueryable object's Expression contains a certain "Where clause".

For example, given as IQuer开发者_运维技巧yable instance, which could be something like:

var query = customers.Where(c => c.Name == "Test");

How can I determine if the query is filtering the customers by Name?


You have to walk the expression tree (IQueryable.Expression), if you are on .NET4 ExpressionVisitor class helps.

0

精彩评论

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