开发者

SQL from EntityDataSource

开发者 https://www.devze.com 2023-01-23 08:02 出处:网络
Is there an easy way to see SQL statements generated by EntityDa开发者_StackOverflow社区taSource?

Is there an easy way to see SQL statements generated by EntityDa开发者_StackOverflow社区taSource?

SQL Server profiling/tracing is not an option here.


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.


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.

0

精彩评论

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

关注公众号