How can i find out when my program execute a linq expression what sql query has been executed?
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.
Profiling is a sure way. Depending on the LINQ provider, this may also be inbuilt, for example with LINQ-to-SQL you can assign anything to
.Logand it will write the queries as it does them. At the simplest level:Internally, we use a custom ADO.NET stack for this (and some other things). It looks like a
SqlConnection(and LINQ-to-SQL is perfectly happy with it), but it does some logging and profiling for us on every command executed, so we can see where our long running operations are. I think Sam is looking to make this available to the public if you want.