Logging SQL statements of Entity Framework 5 for database-first aproach

前端 未结 1 1259
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-17 03:50

I\'m trying to use Entity Framework Tracing Provider to log the SQL staments generated.

I changed my context class to something like this:

public par         


        
1条回答
  •  心在旅途
    2021-01-17 04:17

    After modifying your code, you need to enable tracing in your web.config like this:

    
    
      
        
          
        
      
    
    

    The name of your TraceSource should be your context name prefixed with 'EntityFramework'. Make sure that you disable tracing when you deploy your application to production by setting the switchValue to Off.

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