Home » .Net Framework

Tracing The Root Cause of a SQL Query From the EF

I want to be able to easily tie the TSQL I'm seeing executed via SQL Profiler to the calls to the ObjectContext that was the "root cause" for the query.

I was hoping to see some event exposed by the ObjectContext which was raised when the ObjectContext was about to execute against the data store, but I don't see any such option.



2 Answers Found


Answer 1

Take a look at this: http://huagati.blogspot.com/2010/06/entity-framework-support-in-huagati.html   ...it will allow you to profile queries, and ties managed code call stacks to queries with execution plans, I/O cost etc...

There is also Jarek Kowalski's EFTracingProvider that will allow you to intercept and log queries:

I think the 'Data Points' column by Julie Lerman in an upcoming issue of MSDN Magazine will cover EF profiling and some tools available for that. Not sure when that will be out though...  Julie?



  Cool tools for Linq-to-SQL and Entity Framework 4:
 huagati.com/dbmltools - Rule based class and property naming, Compare and Sync model <=> DB, Sync SSDL <=> CSDL (EF4)
 huagati.com/L2SProfiler - Query profiler  for Linq-to-SQL and Entity Framework v4

Answer 2

Ah, cool app. Thanks for the info.


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure