First, trace the SQL query in EF Code.

asp.net-mvc c# entity-framework sql

Question

I would want to be able to capture all of the SQL queries that the DbContext generates when I'm using Entity Framework Code First. There was a DB log in Linq to SQL, but I can't seem to locate it in EF. I could then output them to the website or place them into a log.

EntityFramework Assembly 4.1.0.0 is the version I'm using.

1
18
3/15/2013 5:05:30 AM

Popular Answer

The EF Profiler, Entity Framework is your greatest option, but it's regrettably not free.

Run a manual query to get the SQL it will produce.ToString() on theIQueryable however each question will have to be handled separately.

The Sql Server Profiler, which, I think, is included with Sql Server Management Studio, may be opened and used to log the sql statements if you are using MS SQL Server as your backend.

6
5/29/2011 3:41:55 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow