问题:无法正确设置 LINQPad 连接到我的 Entity Framework dll。
- 我下载了 LINQPad (v4.42.01)
- 我开始使用 Entity Framework DbContext POCO 驱动程序创建新连接
- 在设置对话框中,我指向我的 C# 项目的 dll,它找到了合适的 DbContext 类。
- 接下来我将配置文件指向我的 C# 项目的 app.config
- 当我点击“测试”按钮时,出现了这个错误:
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/