Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / SQL

See the SQL Generated by LINQ

5.00/5 (6 votes)
8 Apr 2011CPOL 13.7K  
Or, there's always Scott Guthrie's LINQ To SQL Debug Visualizer[^].[Edit]While I'm posting links there is a nice utility that can output the generated SQL to the Debug Window in VS written by Kris Vandermotten.You can get it here[^].To use it: MyDataContext db = new...
Or, there's always Scott Guthrie's LINQ To SQL Debug Visualizer[^].

[Edit]
While I'm posting links there is a nice utility that can output the generated SQL to the Debug Window in VS written by Kris Vandermotten.
You can get it here[^].

To use it:
C#
MyDataContext db = new MyDataContext();

db.Log = new DebuggerWriter();


Also, if you have downloaded the Visual C# 2008 Samples[^] (VB 2008 Version[^]), you will find an ObjectDumper off the LINQ Samples folder, that allows displaying any kind of object on the console output. All the child properties are also displayed and you can even define how deep you want to go through child properties.

Since one of it's overloaded Write() methods allows you to specify a TextWriter and the DebuggerWriter, linked to above, is a TextWriter descendant, you can also get ObjectDumper to output to the Debug Window.

[/Edit]

[Edit II (Edit Harder)]
Further to my previous edit I have now found a WPFified implementation of ObjectDumper here[^].
[/Edit II (Edit Harder)]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)