I am trying to view the generated sql that Entity Framework 5.0 generates from an object query. All over the world ( for example, ) everyone says to pass an IQuerable to an ObjectQuery , and then use toTraceString () to return the generated query.
However, I keep getting the exception excluded:
Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'System.Data.Entity.Infrastructure.DbQuery`1[System.String]' to type 'System.Data.Objects.ObjectQuery'.
What is the new way to do this in Entity Framework 5?
logging entity-framework-5 entity-framework
Rafi
source share