linqpad - LinqPad在向 Entity Framework 添加连接时遇到麻烦

标签 linqpad

我是 Entity Framework 和Linq实体的新手,我想尝试使用LinqPad,但我不知道如何与已创建的edmx模型建立连接。
我有一个MVC项目,并且针对SQL Sever数据库(开发服务器,而不是本地计算机上的一个)添加了ADO.Net实体数据模型。对Build.Right单击了设计器表面,然后添加了代码生成项。那给了我两个.tt文件夹,一个给我的dbContext类,另一个给我所有的类。

打开LinqPad,单击添加连接。指向我的解决方案bin文件夹中的.dll文件,然后在dbContext的全类型名称中选择我创建的实体。现在是这样,我在进行这项工作时遇到了麻烦。我指向解决方案web.config文件,当我单击“测试”按钮时,出现错误消息“无法加载文件或程序集'Entity Framework version = ...”和“系统找不到指定的文件。(C:\users ..\web.config第9行“有什么想法吗?

最佳答案

我将 configSections 从配置文件和连接工作中删除了。

  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="System.Data.SqlServerCe.4.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>

关于linqpad - LinqPad在向 Entity Framework 添加连接时遇到麻烦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10605859/

相关文章:

c# - LINQ 表达式语法如何与 Include() 配合使用以进行预加载

c# - 无效操作异常 : No method 'Where' on type 'System.Linq.Queryable' is compatible with the supplied arguments

c# - 使用LINQPAD的lprun.exe时,如何从自定义程序包源还原NuGet程序包?

linq-to-sql - LINQ to Entities 未返回预期结果

performance - 空数据库的 RavenDB 慢查询

c# - 如何在 LINQPad 中显示 FolderBrowserDialog?

c# - LINQpad 线程行为

nuget - 在 Linqpad 中更改 nuget 包位置

c# - 简单的Linqpad Linq join语句,选择所有字段

wpf - 在 LinqPad 中创建 WPF 示例