开发者

How can I debug EF? (analyze SQL queries)

开发者 https://www.devze.com 2023-04-10 07:02 出处:网络
How can I debug the Entity Framework? Can I see which queries it is actual开发者_Python百科ly trying to execute to the SQL server, to troubleshoot issues?Check out the MVC Mini Profiler: http://code.g

How can I debug the Entity Framework? Can I see which queries it is actual开发者_Python百科ly trying to execute to the SQL server, to troubleshoot issues?


Check out the MVC Mini Profiler: http://code.google.com/p/mvc-mini-profiler/

It's very lightweight, doesn't intrude on your app, and is easily removed if need be. Plus, Stack Overflow uses it.


You can cast your query to ObjectQuery and then use ObjectQuery.ToTraceString() - that returns the full SQL for your query. Alternatively of course you can simply use SQL Profiler on your database to see what SQL gets executed.


You can use Entity Framework Profiler. http://efprof.com/.


You could use a Monitoring tool from the Server to watch the queues directly.
For MSSQL Server see: http://blog.pengoworks.com/index.cfm/2008/1/3/View-recently-run-queries-in-MSSQL-2005

0

精彩评论

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