65.9K
CodeProject is changing. Read more.
Home

See the SQL Generated by LINQ

starIconstarIconstarIconstarIconstarIcon

5.00/5 (6 votes)

Apr 7, 2011

CPOL
viewsIcon

13663

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:
  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)]