I used to use the context.Log for tracing LINQ to SQL generated SQL Statements as shown in Sql Server Query Visualizer – Cannot see generated SQL Query
conte
The Clutch.Diagnostics.EntityFramework (available in NuGet) works perfectly for me, and it's simpler than the EFTracingProvider.
UPDATE for EF 6:
Starting with Entity Framework 6, anytime Entity Framework sends a command to the database this command can be intercepted by application code. This is most commonly used for logging SQL, but can also be used to modify or abort the command.
Specifically, EF includes:
* A Log property for the context similar to DataContext.Log in LINQ to SQL.
* A mechanism to customize the content and formatting of the output sent to the log.
* Low-level building blocks for interception giving greater control/flexibility.
See http://msdn.microsoft.com/en-US/data/dn469464