查看 EF4 生成的查询?
LINQ-to-SQL 有多种方法(包括可视化插件)来查看从 IQueryable 生成的 SQL。
我找不到 Entity Framework 4 的等效项。StackOverflow 上没有任何内容,也没有博客。它是如何完成的?
最好,我希望能够在代码中完成此操作,而不必实际执行查询来查看它。
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有几种查看 sql 的方法。
在 ObjectQuery 上执行
商业
there are several approaches to looking at the sql.
Free
Commercial
如果您无法使用任何其他解决方案,并且您有权访问 SQL Machine,则可以尝试使用 SQL Server Profiler。
在 SQL Server Management Studio 中,您可以执行以下操作:
工具 -> SQL Server 探查器。
创建一个新的跟踪并运行您的代码,您应该会看到查询出现。您可以创建一些过滤器,这样您就不会看到您可能不关心的安全/审计内容。
If you can't get any of the other solutions to work, you could try using the SQL Server Profiler if you have access to the SQL Machine.
Within SQL Server Management Studio you can do the following:
Tools -> SQL Server Profiler.
Create a new Trace and run your code and you should see the queries come across. You can create some filters so you don't see the security / audit stuff which you probably don't care about.
您好,有这个可视化工具...但是我无法让它为我工作...你可以尝试一下..我建议使用 LINQPad 进行查看您可以设置 ef 连接并执行查询。
Hi there is this visualizer...but I could not get it to work for me...you could try it..I would recommend LINQPad for viewing your queries you can setup your ef connection and execute your queries.