public class Context : DbContext
{
public Context(string connString) : base(connString)
{
Database.SetInitializer(new MyContextInitializer());
}
In my case (exactly the same error) it was solved by changing the default connection factory:
Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
Leave out any reference to provider in your connection string because it isn't necessary (this way). I think I read that by default the Database.DefaultConnectionFactory is set to SqlConnectionFactory() but I can't find a reference for that.