MvcMiniProfiler on EF 4.1 Code-First project doesn't profile SQL

前端 未结 1 579
半阙折子戏
半阙折子戏 2020-12-04 18:59

I have version 1.6 of the MvcMiniProfiler referenced (via Nuget) and have set everything up as described on the project homepage at http://code.google.com/p/mvc-mini-profile

相关标签:
1条回答
  • 2020-12-04 19:30

    This one had me stumped for a long time too. It appears that the connection string naming convention takes precedence over Database.DefaultConnectionFactory.

    Could you try renaming the connection string in the web.config?

    from

       <connectionStrings>
           <add name="ReCouponContext" connectionString="..." />
       </connectionStrings>
    

    to

       <connectionStrings>
           <add name="ReCoupon" connectionString="..." />
       </connectionStrings>
    

    and then change

    var factory = new SqlConnectionFactory(ConfigurationManager.ConnectionStrings["ReCouponContext"].ConnectionString);
    

    to

    var factory = new SqlConnectionFactory(ConfigurationManager.ConnectionStrings["ReCoupon"].ConnectionString);
    
    0 讨论(0)
提交回复
热议问题