LINQ To SQL - Get the SQL text query
Usually when we perform a LINQ Query on a SQL table, we don't see the actual query.
To see the query text, use the Log method: aw.Log = Console.Out
public List<Employee> GetEmployees()
{
AdventureWorksDataContext aw = new AdventureWorksDataContext();
var employees = from emps in aw.Employees
select emps;
aw.Log = Console.Out;
return employees.ToList();
}
The result:
