gpt4 book ai didi

asp.net-mvc-4 - MiniProfiler 与 EntityFramework 6 代码优先

转载 作者:行者123 更新时间:2023-12-04 20:09:31 25 4
gpt4 key购买 nike

我试图将 MiniProfiler 连接到一个首先使用 EF6 代码的现有项目,aaaand 现在让我发疯了 :)

问题是默认情况下 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.

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

最佳答案

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

要初始化,只需在您的应用程序启动逻辑中调用以下内容:

using StackExchange.Profiling.EntityFramework6;

...

protected void Application_Start()
{
MiniProfilerEF6.Initialize();
}

在以任何方式使用 EF 之前,请务必调用它。

关于asp.net-mvc-4 - MiniProfiler 与 EntityFramework 6 代码优先,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20269217/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com