【发布时间】:2015-01-03 01:40:02
【问题描述】:
我使用更新 4 并使用 EntityFramework 6.1.1 更新了我的 Visual Studio,但从那时起我在将项目连接到 MySQL 时遇到了问题。
我关注了这个tutorial,在一切正常之前,但现在有了新的更新,我遇到了错误:
身份模型:
static ApplicationDbContext()
{
Database.SetInitializer(new MySqlInitializer());
}
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
//public DbSet<ApplicationUser> ApplicationUsers { get; set; }
public DbSet<Settings> Settings { get; set; }
这里是我的tests,如果有人可以看一下。
错误:
An exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll but was not handled in user code
Additional information: Exception has been thrown by the target of an invocation.
和
Could not load type 'System.Data.Entity.Infrastructure.TableExistenceChecker' from assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
上:
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
我现在的问题是这意味着什么?我可以解决这个问题吗?
【问题讨论】:
-
这不是您的 c# 代码的问题,而是实际的 mysql 查询问题。
-
升级 VS 后,你应该也更新了 MySql 连接器,恕我直言,没有必要急切地放弃 EF 6.1.2
-
MySql 连接器是最新的 6.9.5 和 ODBC 5.3.4
标签: c# mysql asp.net-mvc entity-framework