Entity Framework中查看生成的SQL语句
Entity Framework 4.0 中是这样的,高版本的跟这个有些差异,不太一样,貌似已经到7了
using (Entities entities = new Entities()) { var query = from st in entities.ShiTi select st; ObjectQuery oq = query as ObjectQuery; string sql = oq.ToTraceString(); Console.WriteLine(sql); }