How to debug linq for InsertOnSubmit sql statement?

The following code to work.

db.DBUsers.InsertOnSubmit(new DBUser
    {
        AllTheStuff = valuesBeyondYourWildestDreams
    }
);
db.SubmitChanges();

My guess is that something has changed in the database and the feed is not running because the display is off.
Since the linq visualizer does not work for me (bonus points for fixing it), I want to find another way to find out what exactly is happening and why the feed does not work silently.

Update
I tried to use

db.SubmitChanges(ConflictMode.FailOnFirstConflict);

to get an exception, but it looks like work is working. Except that the database does not have a new new object.

+2
source share
4 answers

SQL Server Profiler, - , , , .

LINQ , SP: StmtCompleted ( ) SQL: StmtCompleted ( TSQL) , , SQL LINQ.

, , . , , msdb master.

0

:

db.Log = Console.Out;
+2

You can also use LINQPad - copy your LINQ code there, go to the database and set dumps for effective LINQ debugging.

0
source

Source: https://habr.com/ru/post/1721688/


All Articles