How to get the SQL generated by Context.SubmitChanges in LINQ2SQL?

362 Views Asked by At

Is there a way to get the SQL script that will be run when calling a Context.SubmitChanges()?

1

There are 1 best solutions below

0
Norman H On BEST ANSWER

The Log property of the DataContext object can be assigned a TextWriter that will be written to with the SQL generated by the request.

Also, see www.linqpad.net for an awesome tool to help diagnose and test Linq-To-SQL queries which has a results window that shows what SQL was generated.