Output LINQ/C# text as a comment into the generated SQL
SQL Server keeps track of all queries, including the text. Sometimes queries don't work as expected (timeout, errors, etc.) but sometimes it's also very useful to have a record of everything that is done as a log. I see the generated SQL. I'd like to know the C# that was entered into the query window. As an option, could you add this as a comment?
-
Richard McCormack commented
Or perhaps use a region:
#region First query
// exec EF query
#endregion
#region Second query
// exec EF query
#endregion
Would output:
--Region First query
--Region Parameters...--Region Second query
--Region Parameters... -
Richard McCormack commented
Would also be great if we could set some text in the ExecutionEngine or ExecutionContext that would be output before the query.
When the script runs lots of queries it is hard to determine which query is which.
e.g.
ExecutionEngine.Context = "First query";
// exec EF query
ExecutionEngine.Context = "Second query";
// exec EF queryWould output:
--First query
--Region Parameters...--Second query
--Region Parameters...