【问题标题】:MiniProfiler with EntityFramework 6 code firstMiniProfiler 与 EntityFramework 6 代码优先
【发布时间】:2013-12-14 16:10:15
【问题描述】:

我曾尝试将 MiniProfiler 连接到首先使用 EF6 代码的现有项目,aaa 而这让我现在很抓狂:)

问题在于,默认情况下 MiniProfiler 与 EF 4.1 一起使用,而对于 6.0,他们已经实现了一种快速解决方案 https://github.com/SamSaffron/MiniProfiler/pull/134

但似乎它不适合我。 每次我启动应用程序时,我都会收到以下异常:

System.InvalidOperationException: The Entity Framework provider type 'StackExchange.Profiling.Data.EFProfiledSqlClientDbProviderServices, MiniProfiler.EntityFramework6' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

有人遇到过类似的问题吗? 谢谢!

【问题讨论】:

    标签: asp.net-mvc-4 entity-framework-6


    【解决方案1】:

    EF6 nuget 已发布。它可用here 并且可以使用Install-Package MiniProfiler.EF6 -Pre 安装

    要初始化,只需在应用程序启动逻辑中调用以下代码:

    using StackExchange.Profiling.EntityFramework6;
    
    ...
    
    protected void Application_Start()
    {
        MiniProfilerEF6.Initialize();
    }
    

    确保在以任何方式使用 EF 之前调用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-05
      • 1970-01-01
      • 2017-05-07
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多