I'm using the default template for ASP.NET MVC 5 with EF 6. It generates the Identity model as
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
I would like to be able to manage and edit the list of users, so I scaffolded the identity model and it added the following line in the ApplicationDbContext class.
public System.Data.Entity.DbSet<QProj.Models.ApplicationUser> ApplicationUsers { get; set; }
I know this is wrong, but I'm not sure how to resolve this.
These are steps made me successfully scaffolding ApplicationUser:
DbSet<MyAppUser> MyAppUsers
for ApplicationDbContext, delete itdb.MyAppUsers
to db.Users
Then you're good to go, hope this helps