I have two entity framework contexts, one for MySql and one for sql. If I run the app I get the following error
The default DbConfiguration instance was used by the Entity Framework before the 'MySqlEFConfiguration' type was discovered.
However if I do discover the database type on app start by giving it the Database.SetInitializer<MySqlContext>
, my normal sql context is now trying to connect using the mysql provider.
My MySql Context
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class ZipCodeContext : DbContext
{
public DbSet<ZipCode> ZipCodes { get; set; }
}
My Normal Context
public class MyContext : DbContext
{
public DbSet<MyClass> MyClasses{get;set;}
}
and finally my web config for the entity framework section
<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>
I hope this is clear enough, I'm banging my head on the desk