Error: "Invalid column name 'ApplicationUser_Id'" when adding claims

c# claims entity-framework-6

Popular Answer

This mistake happens becauseApplicationUser receives fromIdentityUser Entity Framework cannot determine the right ID, thus it enters "ApplicationUser Id" in place of the correct "Id."

Add the below code to ApplicationDbContext.OnModelCreating(DbModelBuilder modelBuilder) to fix this:

modelBuilder.Entity<ApplicationUser>().HasKey<string>(l => l.Id); 
1
10/31/2017 6:43:51 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow