LinqPad在向实体框架添加连接时遇到麻烦 [英] Having trouble with LinqPad Adding a Connection to Entity Framework

查看:65
本文介绍了LinqPad在向实体框架添加连接时遇到麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am new to Entity Framework and Linq to Entities and I want to try LinqPad but I can't figure out how to make a connection to the edmx model I have created. I have an MVC project and I added an ADO.Net Entity Data Model against a SQL Sever database ( a Development server, not one on my local machine) Did a Build.Right click in my designer surface and Add Code Generation Item. That has given me two .tt folders, one for my dbContext class, one with all my classes.

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

Open LinqPad click on Add Connection. Point to the .dll file in my solutions bin folder, then in the Full Type Name of dbContext I choose the entity I created. Now is whee I am having trouble making this work. I point to the solution web.config file and when I click the Test button I get an error saying "Could not load file or assembly 'Entity Framework version=..." & "The system cannot find the file specified. (C:\users..\web.config line 9" Any ideas?

推荐答案

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

I took configSections away from config file and connection works.

  <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在向实体框架添加连接时遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆