显示LINQ查询的SQL跟踪实体框架3.5的最佳方法 [英] Best way to show the SQL trace of a LINQ query to Entity Framework 3.5
本文介绍了显示LINQ查询的SQL跟踪实体框架3.5的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
显示LINQ查询的SQL跟踪实体框架3.5的最佳方式?
Best way to show the SQL trace of a LINQ query to Entity Framework 3.5?
我使用ASP.net和EF 3.5。
I am using ASP.net and EF 3.5.
Dim dbo As Web.Portal.RBMEntities = New Web.Portal.RBMEntities
Dim Query = From RoleAllocations In dbo.RoleAllocations Where RoleAllocations.user_id = _ID And RoleAllocations.expire_date > Today Select RoleAllocations
' Console write the SQL trace???
三江源!
推荐答案
我只是试图做到这一点:
I just attempted to do this:
Dim TraceString As String = TryCast(Query, ObjectQuery).ToTraceString
伟大的工程,并返回LINQ语句的SQL跟踪。
Which works great and returns the SQL trace of the LINQ statement.
这篇关于显示LINQ查询的SQL跟踪实体框架3.5的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文