Basically the 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. This method is not called if you derive from IdentityDbContext
and provide your own definition of OnModelCreating
as you did in your code. With this setup you have to explicitly call the OnModelCreating
method of IdentityDbContext
using base.OnModelCreating
statement.
This answer also discusses the option I posted here