Valera
Valera

Reputation: 619

SQL from EntityDataSource

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

SQL Server profiling/tracing is not an option here.

Upvotes: 0

Views: 885

Answers (2)

Jeff Ogata
Jeff Ogata

Reputation: 57833

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.

Upvotes: 1

Ghidello
Ghidello

Reputation: 1863

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.

Upvotes: 1

Related Questions