Click here to Skip to main content
15,868,049 members
Articles / Programming Languages / SQL
Alternative
Tip/Trick

See the SQL Generated by LINQ

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
8 Apr 2011CPOL 12.8K   3   2
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)


Written By
Retired
United Kingdom United Kingdom
Retired Systems Admin, Programmer, Dogsbody.
Mainly on Systems for Local Government, Health Authorities,
Insurance Industry - (COBOL eeeeeeeugh).
Inventor of Synchronized Shopping.

Comments and Discussions

 
GeneralReason for my vote of 5 Thanks for sharing these links. Pin
linuxjr7-Apr-11 17:30
professionallinuxjr7-Apr-11 17:30 
GeneralNice link, thanks! Pin
Karthik. A7-Apr-11 3:12
Karthik. A7-Apr-11 3:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.