0

Is there an easy way to see SQL statements generated by EntityDataSource?

SQL Server profiling/tracing is not an option here.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Valera
  • 537
  • 7
  • 14

2 Answers2

1

I used to use NHProf a profiler for NHibernate and it is awesome. So I can surely say that you should try the Entity Framework Profiler
I just checked and, as for NHProf, there is a free trial version.

Ghidello
  • 1,863
  • 20
  • 21
  • Thank you for suggestion - but I was wondering if I could see SQL statement using existing VS 2010 tools. – Valera Nov 04 '10 at 20:16
1

You can cast to ObjectQuery and call ToTraceString:

ObjectSet<User> objectSet = ObjectSet;
var query = (ObjectQuery)(objectSet.Where(u => u.LastName == "Doe").Select(u => u));
string trace = query.ToTraceString();

For tracing/caching you can try the EF Caching and Tracing Provider Wrapper. I haven't had a chance to try it yet, but it's definitely on my to do list.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jeff Ogata
  • 56,645
  • 19
  • 114
  • 127
  • Looks interesting but is quite involved: I was wondering if there was something similar to this solution http://stackoverflow.com/questions/1412863/how-do-i-view-the-sql-generated-by-the-entity-framework – Valera Nov 04 '10 at 20:29