Linq to SQL Debug Visualizer

I have been learning Linq for sometime. However I always had some difficulty figuring out what SQL statement got generated for my Linq query. Although there are numerous ways to find the SQL statement that get generated but none of them were with out code or having to leave visual studio environment. Last week I discovered a really good tool called Linq to SQL Visualizer which allows me look at my Linq query in a Visualizer that exactly shows the SQL statement generated. It also allows you to execute your query from there as well.

You can download Linq to SQL Visualizer over here

http://www.scottgu.com/blogposts/linqquery/SqlServerQueryVisualizer.zip

Unfortunately Linq to SQL is not part of visual studio 2008. The Visualizer has to be downloaded separately.

Once you have downloaded and extracted the sqlQueryVisualizer, you have to copy SqlServerQueryVisualizer.dll from bin/debug directory onto

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers

Before copying the dll, make sure that you have all instances of visual studio shutdown.

After copying the dll, when you hover over  Linq to SQL query, you will get a magnifying glass and clicking on it will open the SQL Visualizer. Here is how the screen shot looks like.

 SQL Server Query Visualizer

 

You also have the option of executing the query from there and also seeing the results.

2 Comments

Comments have been disabled for this content.