Entity Framework ADO.NET Sql.Data.Client provider not found

.net c# entity-framework

Question

I have a similar issue to the one raised in the question System.Data.SqlClient is an invariant name for the ADO.NET provider, yet there was no Entity Framework provider discovered for it., and the error message reads as follows:

"The machine or application configuration file does not list the ADO.NET provider with the invariant name "System.Data.SqlClient" or it could not be loaded. Details are provided in the inner exception."

I have reinstalled Entity Framework (EF6) via the Package Manager Console, as indicated by the responses to the linked question, but the issue still exists. I also verified that my project references EntityFramework.SqlServer.dll. The connection string is shown below as it appears in App.config:

<add name="DesignModel"    ConnectionString="metadata=res://*/DesignModel.csdl|res://*/DesignModel.ssdl|res://*/DesignModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=C071E;initial catalog=CTD2;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />     

This is even the more confusing because I created the exact identical entities and context in another project using EntityFramework, and it worked just fine.

When attempting to execute these lines, an error is displayed:

DesignModel designContext = new DesignModel();
designContext.MoPerfIDs.Load();

where DesignModel denotes the class from which DbContext is inherited.

This is the complete App.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
       <section name="ppe.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
    <!-- 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=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>

  <connectionStrings>
    <add name="DesignModel" connectionString="metadata=res://*/DesignModel.csdl|res://*/DesignModel.ssdl|res://*/Design    Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=MONNMC071E;initial catalog=CTD2;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
        <parameters>
            <parameter value="System.Data.SqlClient" />
        </parameters>
    </defaultConnectionFactory>
    <providers>
        <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
</entityFramework>
</configuration>

I would appreciate any assistance. I appreciate it.

1
17
5/23/2017 12:25:08 PM

Popular Answer

The Entity Framework provider for the System must be registered. Data.SqlClient is a type of SQL connection. In app.config, you should have:

<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=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
3
11/21/2013 3:08:07 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow