The entity type ‘IdentityUserLogin’ requires a primary key to be defined [duplicate]

keys of Identity tables are mapped in OnModelCreating method of IdentityDbContext and if this method is not called, you will end up getting the error that you got.

All you need to do is call.

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
  base.OnModelCreating(modelBuilder);
}

The original answer (just copied for other’s reference just in case) here

Leave a Comment