How do I view the SQL generated by the Entity Framework?

后端 未结 22 3286
别那么骄傲
别那么骄傲 2020-11-21 05:35

How do I view the SQL generated by entity framework ?

(In my particular case I\'m using the mysql provider - if it matters)

22条回答
  •  庸人自扰
    2020-11-21 06:12

    You can do the following in EF 4.1:

    var result = from x in appEntities
                 where x.id = 32
                 select x;
    
    System.Diagnostics.Trace.WriteLine(result .ToString());
    

    That will give you the SQL that was generated.

提交回复
热议问题