How to get the TSQL Query from LINQ DataContext.SubmitChanges()

后端 未结 7 907
猫巷女王i
猫巷女王i 2020-12-13 20:48

I\'m using Linq to SQL. I have a DataContext against which I am .SubmitChanges()\'ing. There is an error inserting the identity field, and I\'d like to see the query it\'s u

7条回答
  •  情歌与酒
    2020-12-13 21:08

    Further to Portman's answer, if you're a console application it's as simple as:

    myDataContext.Log = Console.Out;
    

    Or you could use something like Linq2SQL Profiler which is a rather excellent tool and in fact the right tool for the job:

    Linq to SQL Profiler - Real-time visual debugger for Linq to SQL

提交回复
热议问题