C# – Tracing LINQ TO SQL generated queries in ASP.NET MVC

cdebugginglinqlinq-to-sqlvisual-studio-2008

Quick question on LINQ to SQL generated queries output.

I am in a ASP.NET MVC project, Visual Studio 2008, and I am trying what's suggested in MSDN documentation:

MyDataContext _dc = new MyDataContext();
_dc.Log = Console.Out;

But nothing is being shown on "Output" window (CTRL+Alt+O).

Is there is something else I need to configure in order to make LINQ to SQL dumping debug info to Output window in Visual Studio 2008?

I don't know if it makes any difference, but my entities (and MyDataContext class) are located in a separate class library project.

Best Answer

You can use LINQ to SQL Visualizer. Attach the debugger, add a breakpoint and you'll be able to use it.