Is there a way to build a linq query in order to use it later or to display/print it (and more specifically, the where clause) ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What exactly is it you want? You can capture just the expression from the
Where– something like:Because this is going to an expression tree, there is a meaningful
ToString().If you want the SQL (etc), then that will be implementation-specific. For example, with LINQ-to-SQL you can use
.Log– for example,ctx.Log = Console.Out;If you want the predicate out of the middle of an
IQueryable<T>feed, then that is much trickier…