Best way to show the SQL trace of a LINQ query to Entity Framework 3.5

后端 未结 3 689
无人共我
无人共我 2021-01-25 05:37

Best way to show the SQL trace of a LINQ query to Entity Framework 3.5?

I am using ASP.net and EF 3.5.

Dim dbo As Web.Portal.RBMEntities = New Web.Portal         


        
相关标签:
3条回答
  • 2021-01-25 05:58

    I just attempted to do this:

            Dim TraceString As String = TryCast(Query, ObjectQuery).ToTraceString
    

    Which works great and returns the SQL trace of the LINQ statement.

    0 讨论(0)
  • 2021-01-25 06:03

    Entity Framework Profiler found here http://efprof.com/ does this very elegant.

    It is easy to start using, and it also gives some hints on possible "issues" with your queries. It will help you get an understanding about whats going on under the "EF hood".

    It is not free but there is a 30 days trial for it. I would recommend it for EF newbies as it can be confusing to understand the way EF abstracts the database chatter.

    The setup is smooth and its lightweight. Once downloaded, read the "How to use.txt" to get it going.

    0 讨论(0)
  • 2021-01-25 06:04

    Use SQL profiler?... assuming you mean SQL Server

    0 讨论(0)
提交回复
热议问题