CSharpFeeds - All your C# feeds in one place.

Sponsors

Tuesday, July 17, 2007

Sending the LINQ to SQL log to the debugger output window

by Fabrice Marguerie via Fabrice's weblog on 7/17/2007 9:55:00 PM

When debugging LINQ to SQL code, did you wish you could easily see the SQL that gets executed? Of course there is the DataContext.Log property that is available for that. You can assign any TextWriter to this property. Console.Out is a good candidate for example, but it doesn't help much for web applications and doesn't integrate with Visual Studio nicely. Fortunately, Kris Vandermotten has a nice solution: DebuggerWriter. It's an implementation of TextWriter that writes to the debugger log.

With this solution, plug an instance of DebuggerWriter into your DataContext's Log property, and you'll be able to see the SQL queries appear in Visual Studio's Output window.

By the way, Kris also has other interesting posts about LINQ. For example, he has a series of posts about the impact the use of LINQ to SQL has over a classical Data-Access Layer (part 1, part 2).


Cross-posted from http://linqinaction.net
email it!bookmark it!digg it!

Original Post: Sending the LINQ to SQL log to the debugger output window

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us