获取linq生成的sql语句

命名空间:using System.Data.Objects; 

var query = db.TxtRes.Join(db.LangRes, a => new { id1 = a.ResID, id2 = a.ResID }, b => new { id1=b.ID,id2=b.ID }, (a, b) => new { a.ID, a.ResID, a.Lang, b.Key });

       var objectQuery = query as System.Data.Objects.ObjectQuery;
       return objectQuery.ToTraceString(); //获取sql语句

posted @ 2015-12-10 11:42  甜菜波波  阅读(1254)  评论(0编辑  收藏  举报