Recently, when studying the use of EF lazy loading and greedy loading, you want to see the SQL generated by LINQ. Starting with Vs--> Debugging-the window-->intellitrace event to see the generated SQL is less accurate than it is. And then think of it as if you could see SQL server2008 with SQL Server Profilter.
1. First, start SQL Server Profilter. Startup method: In SQL Server Management Studio, click the menu "Tools"-->sql Server profilter;
Enter your username and password in the popup screen and click Connect.
2. Select the Tracking property. After the connection is complete, the following screen appears
The interface has two tab, "General" tab can set the tracking name and template, tracking time, etc., if it is instant view, all by default. The main thing is to set a second tab "event Selection". Here we simply select the trace stored procedure completion event and the TSQL completion event. Also tick "Show all Columns" and tick the "DatabaseName" column in the event.
3. Here we can also select "column selector" according to our needs, to filter the event output. If we can set "DatabaseName" as our Tracking database name, if you want to perform performance optimizations such as viewing long-running SQL, you can set "Duration" to be larger than a certain threshold value.
4. View the tracked events and SQL. Once you have completed the above settings, click Run and start tracking the events we set up.
Using SQL Server profilter to track SQL