Problems with LinqPad Adding Entity Framework Connection

I am new to Entity Framework and Linq for Entities, and I want to try LinqPad, but I cannot figure out how to connect to the edmx model that I created. I have an MVC project, and I added the Entity Data ADO.Net data model to the SQL Sever database (development server, not one on my local machine). Configured Build.Right on my surface as a designer and added a code generation element. This gave me two .tt folders, one for my dbContext class, one with all my classes.

Open LinqPad, click "Add Connection". Point to the .dll file in my bin bin folder, then in Full Type Name dbContext I select the created object. Now it’s hard for me to do this job. I point to the web.config solution file, and when I click the Test button, I get the error message "Failed to load the file or assembly" Entity Framework version = ... "and" The system cannot find the specified file. (C: \ users .. \ web.config line 9 "Any ideas?

+8
linqpad
source share
2 answers

I took configSections away from the configuration file and the connection is working.

<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> 
+10
source share

I had this exact problem with LinqPad 4.42.01. My project is a web project using the EF5 data assembly. I ended up creating the linqPad.config file (below) in the My web project and it works fine.

 <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <remove name="MySqlServer"/> <add name="MySqlServer" connectionString="Data Source=mydb;Initial Catalog=mycat;User ID=iamuser;Password=soopersekret;Trusted_Connection=False" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration> 
+4
source share

All Articles