View EF4 generated queries?
问题 LINQ-to-SQL had several ways, including a visualizer add-in, to view the generated SQL from an IQueryable. I can't find the equivalent for Entity Framework 4. Nothing on StackOverflow, no blogs. How is it done? Preferably, I'd like to be able to do it in code and without having to actually execute the query just to see it. Thanks! 回答1: there are several approaches to looking at the sql. Free On the ObjectQuery do .ToTraceString() that will show u the sql generated for the query. Download ef