SQL from EntityDataSource
-
29-09-2019 - |
Question
Is there an easy way to see SQL statements generated by EntityDataSource?
SQL Server profiling/tracing is not an option here.
Solution
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.
OTHER TIPS
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow