This project has moved and is read-only. For the latest updates, please go here.

How to view SQL generated by Entity Framework

Apr 27, 2015 at 6:41 PM
I've been trying to debug my app through tests and I want to view the SQL generated by EF and my linq queries.

I've tried attaching a delegate to dbContext.Database.Log and by using a custom implementation of IDbCommandInterceptor. Both of these should work but both return null for the CommandText when run. It's like Effort doesn't actually generate CommandText or SQL to be run on the server. The value is always null. Where can I go to find this kind of information.
May 16, 2015 at 12:08 PM

Effort does not use SQL statements for executing queries. You should switch to your database specific provider, if you wanted to inspect the SQL commands.