EDMX模型是不同步我的数据库模型 [英] EDMX model is out of sync with my database model

查看:582
本文介绍了EDMX模型是不同步我的数据库模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用code第一种方法,但我不知道为什么我有这个问题。
这里是我的AccountViewModel的一部分:

I am using code first approach, but I am not sure why I am having this issue. Here's a part of my AccountViewModel:

public class LoginViewModel
{
    [Required]
    [Display(Name = "User name")]
    public string UserName { get; set; }

    [Required]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { get; set; }

    [Display(Name = "Remember me?")]
    public bool RememberMe { get; set; }
}

和这里的错误消息:

System.Data.SqlClient.SqlException: Invalid column name 'Email'.
Invalid column name 'EmailConfirmed'.
Invalid column name 'PhoneNumber'.
Invalid column name 'PhoneNumberConfirmed'.
Invalid column name 'TwoFactorEnabled'.
Invalid column name 'LockoutEndDateUtc'.
Invalid column name 'LockoutEnabled'.
Invalid column name 'AccessFailedCount'.
Invalid column name 'Email'.
Invalid column name 'EmailConfirmed'.
Invalid column name 'PhoneNumber'.
Invalid column name 'PhoneNumberConfirmed'.
Invalid column name 'TwoFactorEnabled'.
Invalid column name 'LockoutEndDateUtc'.
Invalid column name 'LockoutEnabled'.
Invalid column name 'AccessFailedCount'.
Invalid column name 'UserId'.
Invalid column name 'UserId'.
Invalid column name 'Email'.
Invalid column name 'EmailConfirmed'.
Invalid column name 'PhoneNumber'.
Invalid column name 'PhoneNumberConfirmed'.
Invalid column name 'TwoFactorEnabled'.
Invalid column name 'LockoutEndDateUtc'.
Invalid column name 'LockoutEnabled'.
Invalid column name 'AccessFailedCount'.
Line 102:     if (ModelState.IsValid)
Line 103:     {
Line 104:        var user = await UserManager.FindAsync(model.UserName, model.Password);
Line 105:        if (user != null)
Line 106:        {

请帮助我了解为什么我收到这个错误?

Please help me understand why I am getting this error?

推荐答案

我想我找到了我的问题的答案。
它的更新包:从版本1 Microsoft.AspNet.Identity.EntityFramework到版本2

I think i found the answer for my problem. It's the updated package: Microsoft.AspNet.Identity.EntityFramework from version 1 to version 2.

显然新版本具有需要被映射的新的数据库的属性。
更多关于这个问题:<一href=\"http://blogs.msdn.com/b/webdev/archive/2013/12/20/updating-asp-net-applications-from-asp-net-identity-1-0-to-2-0-0-alpha1.aspx\"相对=nofollow>链接

apparently the new version has new database attributes that needs to be mapped. More on this issue: Link

这篇关于EDMX模型是不同步我的数据库模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆