I am learning Entity Framework and trying to create a sample code using Code first approach. While running this code i am getting above mention error. I am developing code on VS 2012 and database is Microsoft SQL Server. it also shows error message as "Unable to find the requested .Net Framework Data Provider. It may not be installed."
I've developed 3 class files and one of this file is for interacting with database which throws error at:
public List<Standard> GetStandards()
{
StandardDBContext standardDBContext = new StandardDBContext();
return standardDBContext.Standard.Include("Student").ToList();
}
My web.config file:
<connectionStrings>
<add name="StandardDBContext" connectionString="server=CPC2\SQLEXPRESS; database=SchoolDatabase;User Id=sa;Password=password; integrated security=true" providerName="System.Data.SqlClient;" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</DbProviderFactories>
</system.data>
<entityFramework>
<!--<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0"/>
</parameters>
</defaultConnectionFactory>-->
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
Can any one please help me. Your help will be appreciated.