How can I see what TSQL Entity Framework is generating for a query?
Imagine this linq query:
return db.Projects.Where(p =&g开发者_C百科t; p.ProjectID == id);
How can I see what TSQL it's generating?
I use LINQPad
You can see your queries as lambda expressions or SQL
SQL Server profiler does exactly this. If you are on SQL Server Express, there is an open source alternative called AnjLab Sql Profiler since SQL server profiler isn't included with express.
You can attach the Sql Server Profiler to your database while running the query. Furthermore, have a look at the tracing and caching utility for EF.
精彩评论