EF 調試跟蹤生成的SQL語句

IQueryable query = from x in appEntities
             where x.id = 10
             select x;

var sql = ((System.Data.Objects.ObjectQuery)query).ToTraceString();

或者 EF6 :sql

var sql = ((System.Data.Entity.Core.Objects.ObjectQuery)query)
            .ToTraceString();
相關文章
相關標籤/搜索