0

In my controller I have a query outlined as below:

using (var db = new NorthwindEntities())
        {
            var query = db.Orders
                .Select()
                .OrderBy()
                .Skip()
                .Take();
        }

I would like to get the SQL output of this query.

I have tried using getCommand() but it is saying that NorthwindEntities doesn't have a definition for it. Is there another way to try and get it?

ekad
  • 14,436
  • 26
  • 44
  • 46
user3431504
  • 149
  • 1
  • 1
  • 9
  • 3
    As the answer of [Get SQL query from LINQ to SQL?](http://stackoverflow.com/questions/18237312/get-sql-query-from-linq-to-sql) shows, you can either put a breakpoint and use the debugger to check it, or use `string sql = query.ToString();` to view the SQL. – Keyur PATEL Sep 14 '16 at 02:37
  • Thanks! Simple answer -.-; – user3431504 Sep 14 '16 at 02:44

1 Answers1

1

you can see all queries in IntelyTrace stack or, for example in dotTrace report. Another way is to use break point and hover mouse over variable. Very handy, don't need to modify code, all in one place

Traveler
  • 191
  • 1
  • 10