Retrieve LINQ to sql statement (IQueryable) WITH parameters

前端 未结 4 2058
广开言路
广开言路 2021-02-01 14:16

I\'m trying to figure out if there\'s a way to retrieve the (full) sql statement that gets executed on the database server.
I found something already, but it does not exactl

4条回答
  •  情话喂你
    2021-02-01 15:05

    Once you get the Command you can print the CommandText and then loop through the Parameters collection and print all the individual parameters.

    Also there is the linq-to-sql debug visualizer which does the same in debug mode.

    A really nice tool to view the queries as they are happening is the Linq-to-sql profiler

提交回复
热议问题