How can I see the SQL query generated from LINQ to SQL when debugging inside a WCF service? I thought I could just set dataContext.Log = Console.Out and SQL would be written to the output / immediate window. Is this not because I am hosting using IIS? Console.WriteLine("Hello") does not even write anything to the output / immediate access window.
dataContext.Log = Console.Out
Console.WriteLine("Hello")
How do you see the output of my console?
Instead, you can write it to a file. dataContext.Log accepts any TextWriter.
See this comment for a good way to get a text message writing in Debug.
You can try using System.Diagnostics.Debug.WriteLine() , so when you distribute the Release application, these lines will be removed from the code.
System.Diagnostics.Debug.WriteLine()