EF MySQL ApplicationUser MVC5

时间:2015-01-03 01:40:02

标签: c# mysql asp.net-mvc entity-framework

我使用更新4和使用EntityFramework 6.1.1更新了我的visual studio,从那时起我就遇到了将项目连接到MySQL的问题。

我跟着这个tutorial并且在一切运行良好之前,但是现在有了新的更新,我遇到了错误:

IdentityModel:

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'.

on:

public ApplicationDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)

我现在的问题是什么意思?我可以解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

我以为只有我才有这个问题!它在您执行升级到Entity Framework 6.1.2时启动!

我现在找到的唯一解决方案是执行降级到6.1.1版本的Entity Framework。

希望有所帮助!