sqllinq

how to see generated sql from a linq query


Just trying to get the sql that is generated by a linq query.


Solution

  • With Linq2Sql

    dc.GetCommand(query).CommandText
    

    see http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getcommand.aspx for more info.

    But I usually use LinqPad