I am trying to setup a existing project to use Entity Framework. I have never used it before and want to learn it on a personal project.
I have a solution with many projects, all related. Login is where I wanna do querys. Model is where the model is. Main is where the program starts.
I have installed EntityFramework onto MySolution.Model.
This is the app.config for Model:
<connectionStrings>
<add name="ALDatabaseContext" providerName="MySql.Data.MySqlClient"
connectionString="server=localhost;port=3306;database=aldatabase;uid=root;password=root"/>
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/>
<provider invariantName="System.Data.SqlClient"
type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
My context is very simple
public class ALDatabaseContext : DbContext
{
public virtual DbSet<User> Users { get; set; }
}
But when I call context from Login I get an exception:
Additional information: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file.
What I am missing?