How do I view the SQL generated by the Entity Framework(ef) on C# on debugging mode

How do I view the SQL generated by the Entity Framework(ef) on C# on debugging mode

You can try these three ways.

IQueryable query = from x in YourEntity
             where x.Id == 11
             select x;

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

in EF6

var sqlCheck = ((System.Data.Entity.Core.Objects.ObjectQuery)query)
            .ToTraceString();

in EF6.3+

var sqlCheck = ((dynamic)entityName).Sql;