entity-framework - LINQPad 查询错误

标签 entity-framework entity-framework-4 linqpad

问题:无法正确设置 LINQPad 连接到我的 Entity Framework dll。

  1. 我下载了 LINQPad (v4.42.01)
  2. 我开始使用 Entity Framework DbContext POCO 驱动程序创建新连接
  3. 在设置对话框中,我指向我的 C# 项目的 dll,它找到了合适的 DbContext 类。
  4. 接下来我将配置文件指向我的 C# 项目的 app.config
  5. 当我点击“测试”按钮时,出现了这个错误:

Error: The type initializer for 'System.Data.Entity.Internal.AppConfig' thre an exception. An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' on one of its dependencies. The system cannot find the file specified. (C:\Code\NET\FTI_Opp_Model\App.Config line 5)

所以我尝试做@Sorax 在 this related question 中所做的事情并将我的 EntityFramework.dll 从我在项目中从 NuGet 获得的那个移动到 LINQPad.exe 文件夹中。这让我更进一步,测试现在起作用了。我很受鼓舞,因为我在 LINQPad 面板中的连接显示了我在它下面的所有实体。

但是当我右键单击我的 Borrower 实体并选择“Borrower.Take(100)”时,我从 LINQPad 收到了这个错误:

The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.

带有内部异常消息:

[A]System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection cannot be cast to [B]System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection. Type A originates from 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'Default' at location 'C:\MarkSisson\LinqPad\EntityFramework.dll'. Type B originates from 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadFrom' at location 'C:\Users\msisson\AppData\Local\Temp\LINQPad\vlnebssu\shadow_ujjvzp\EntityFramework.dll'.

有什么想法吗?

最佳答案

下载 latest beta - 此问题已在 4.42.05 中修复。

关于entity-framework - LINQPad 查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11716020/

相关文章:

vb.net - Entity Framework VB 连接

c# - EF4 代码优先 - 疯狂嵌套的 UNION ALL 和重复的连接?

build-automation - LINQPad - 可以从命令行运行 linqpad 脚本吗?

c# - 是否可以将调试数据从 VS 复制到 Linqpad?

c# - 如何修改使用 DB-first Entity Framework 创建的枚举

entity-framework - 确定我正在使用的 Entity Framework 版本?

c# - 在 Entity Framework 中将 1 映射到 0-1

c# - 设置 web.config 进行部署 - .Net

.net - 将 Entity Framework 与历史数据一起使用

c# - 从 Visual Studio C# 项目调用 LinqPad 7