【问题标题】:EF MySQL ApplicationUser MVC5EF MySQL ApplicationUser MVC5
【发布时间】: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


【解决方案1】:

我以为只有我有这个问题!它在您升级到 Entity Framework 6.1.2 时开始!

我目前找到的唯一解决方案是将实体框架降级到 6.1.1 版本。

希望有帮助!

【讨论】:

  • 谢谢!现在完美运行。我对此感到疯狂,我真的很想与新用户合作
  • 但现在我得到了错误:调用的目标抛出了异常。查看我的编辑
猜你喜欢
  • 2016-07-15
  • 2015-07-21
  • 1970-01-01
  • 2013-12-15
  • 2015-11-13
  • 2021-09-23
  • 2014-01-30
  • 1970-01-01
  • 2016-08-14
相关资源
最近更新 更多