I am extending IdentityUser
, IdentityUserRole
, and IdentityRole
like this:
public class ApplicationUser : IdentityUser
Your context is inheriting IdentityDbContext<TUser> which in turn inherits IdentityDbContext<TUser, IdentityRole, string>
. TUser
in this case is your ApplicationUser
, but the role type is IdentityRole
.
Thus the base class fluent configuration registers IdentityRole
as entity. When you register the derived ApplicationRole
as entity, EF Core treats that as TPH (Table Per Hierarchy) Inheritance Strategy which is implemented with single table having Discriminator
column.
To fix the issue, simply use the proper base generic IdentityDbContext
. Since you also have a custom IdentityUserRole
derived type, you should use the one with all generic type arguments - IdentityDbContext<TUser,TRole,TKey,TUserClaim,TUserRole,TUserLogin,TRoleClaim,TUserToken>:
public class SmartAccountingSetUpContext : IdentityDbContext
<
ApplicationUser, // TUser
ApplicationRole, // TRole
string, // TKey
IdentityUserClaim<string>, // TUserClaim
ApplicationIdentityUserRole, // TUserRole,
IdentityUserLogin<stringy>, // TUserLogin
IdentityRoleClaim<string>, // TRoleClaim
IdentityUserToken<string> // TUserToken
>
{
// ...
}