我有两个实体框架上下文,一个用于MySql,一个用于sql.如果我运行该应用程序,则会出现以下错误
The default DbConfiguration instance was used by the Entity Framework before the 'MySqlEFConfiguration' type was discovered.
但是,如果我确实通过给应用程序指定Database.SetInitializer< MySqlContext>发现数据库类型,则我的常规sql上下文现在正尝试使用mysql提供程序进行连接.
MySql上下文
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class ZipCodeContext : DbContext
{
public DbSet ZipCodes { get; set; }
}
我的正常情况
public class MyContext : DbContext
{
public DbSet MyClasses{get;set;}
}
最后是实体框架部分的Web配置
我希望这很清楚,我在桌子上敲打头