I grab the SQL that will be issued by a LINQ to SQL command and store it in a string in my C# code. I do not want to have it sent to console out, not do I want to analyze it separately in SQL Studio or LinqPad. I want to have that string so that my program can do what it wants with the string. (In reality, I will send it to log4net, but that's incidental).
Does anyone know how to get this? I know that the SQL is not actually issued to the database until you start walking through the iterators, but I am hoping that perhaps there is a way to get the SQL beforehand.