It’s multiple options how we can view generated SQL from LINQ to SQL or Entity framework. My favorite is by SQL Server profiler. BUT sometimes I need something quicker. And here is the option how to look directly at the DB (SQL Server) to the last executed query:
SELECT TOP 5
deqs.last_execution_time AS [Time],
dest.text AS [Query]
FROM
sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE
dest.text like '%vw_Visitor%'
ORDER BY
deqs.last_execution_time DESC
Only one note: Beneficial can by the WHERE condition … I suppose that the query looking under particular Table or View or SP so I can help to SQL server by adding WHERE condition like dest.text like '%vw_Visitor%' = By this I said something like : hey server, give me only query where is mentioned something related with particular View called vw_Visitor.