Having trouble with LinqPad Adding a Connection to Entity Framework

后端 未结 2 1246
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 15:49

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

相关标签:
2条回答
  • 2020-12-10 16:15

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

    <?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>
    
    0 讨论(0)
  • 2020-12-10 16:28

    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>
    
    0 讨论(0)
提交回复
热议问题