I get the following error when I try to register a new user, using Identity 2.0 and the default MVC 5 application:
Invalid column name \'Email\'.
Invalid col
You have to modify all the entities that have been updated in version 2.0, for example:
public partial class AspNetUser
{
public AspNetUser()
{
AspNetUserClaims = new HashSet();
AspNetUserLogins = new HashSet();
AspNetRoles = new HashSet();
}
public string Id { get; set; }
[StringLength(256)]
public string UserName { get; set; }
public string PasswordHash { get; set; }
public string SecurityStamp { get; set; }
[MaxLength(256)]
public string Email { get; set; }
public bool EmailConfirmed { get; set; }
public string PhoneNumber { get; set; }
public bool PhoneNumberConfirmed { get; set; }
public bool TwoFactorEnabled { get; set; }
public DateTime LockoutEndDateUtc { get; set; }
public bool LockoutEnabled { get; set; }
public int AccessFailedCount { get; set; }
public int UserId { get; set; }
public virtual ICollection AspNetUserClaims { get; set; }
public virtual ICollection AspNetUserLogins { get; set; }
public virtual User User { get; set; }
public virtual ICollection AspNetRoles { get; set; }
}
public partial class AspNetUserClaim
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string ClaimType { get; set; }
public string ClaimValue { get; set; }
[Required]
[StringLength(128)]
public string UserId { get; set; }
public virtual AspNetUser AspNetUser { get; set; }
}
You also need to modify mappings of the entities that changed in the OnModelCreating method of your dbcontext, After this you can add your migration