开发者

How to get the sql generated by the entity framework [duplicate]

This question already has answers here: How do I view the SQL generated by the Entity Framework? (23 answers) Closed 9开发者_如何学JAVA years ago.

How can I get the sql script generated by an entity framework query? i.e. If I write

entityDataDontext.table1.Where(r => r.primarykey == 1).First();

then how can I get the SQL which should be somewhat like this:

select * from table1 where primarykey = 1

Thanks in advance :)


When you're going against SQL Server as your backend database, SQL Server Profiler is always the best tool to see exactly what SQL statements are being sent to your database to be processed.

See Introducting SQL Server Profiler for background info.


I can strongly recommend MiniProfiler: http://miniprofiler.com/


Besides using the SQL Server Profiler, you can try Entity Framework Profiler, which does that and more.

It's paid, with a 30-day trial.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜