Home

Does LinqPad Support EF 4.3.1 now?

edited April 2012
If so, how do make it work? I grab the latest version of EF's dll file and paste into my LinqPad folder, the connection string is fine, but when I try to run the query, exception throw.

Comments

  • I was getting an exception related to casting the sections of my config. If this is the error you're experiencing, I was able to make it work by creating a dummy config that only contained the connectionStrings section. And then directing LinqPad to it. Ex:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <connectionStrings>
        <add name="Context" providerName="System.Data.SqlClient" connectionString="Server=.;Database=Reporting;Trusted_Connection=true" />
      </connectionStrings>
    </configuration>
    Let me know if this helps.
  • Thank you Thank you Thank you!!!

    And I can confirm that this method worth with EF5 beta 2!!
  • I've reproduced the error and fixed it for 4.42.5, so that you won't need to edit the config file anymore:
    www.linqpad.net/beta.aspx
  • If anyone is still experiencing this, let me know. I've not been able to reproduce this myself since changing the assembly binding mechanism in v4.42.5.
  • edited September 2012
    Hi Joe, I am still seeing this. This is what I am using and the steps I followed:

    Visual Studio 2010 SP1
    SQL Server 2008R2

    - Create a Console App
    - Add a model
    - Add the EF 4.3.1 package via NuGet
    - Remove the default code generator from the model
    - Add the DBContext template
    - write some code to check it works

    Start LINQPad and add your console app and the config that was created. It will test OK but as soon as you try to run a query you will get the error. The config file created by Visual Studio looks like this:
    
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <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>
      <system.diagnostics>
        <sources>
          <!-- This section defines the logging configuration for My.Application.Log -->
          <source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
              <add name="FileLog" />
              <!-- Uncomment the below section to write to the Application Event Log -->
              <!--<add name="EventLog"/>-->
            </listeners>
          </source>
        </sources>
        <switches>
          <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
          <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
          <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
          <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
      </system.diagnostics>
      <connectionStrings>
        <add name="ReportServerEntities" connectionString="metadata=res://*/Sample.csdl|res://*/Sample.ssdl|res://*/Sample.msl;provider=System.Data.SqlClient;provider connection string="data source=SERVER;initial catalog=ReportServer;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
      </connectionStrings>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" />
          </parameters>
        </defaultConnectionFactory>
      </entityFramework>
    </configuration>
    
  • I am experiencing the same problem as above.
  • Same here. It works with EF4.1, but I get this issue with EF5.
Sign In or Register to comment.