Monday, 15 September 2014

c# - Why Identity 2.0 adds a new column in AspNetUserRoles when I extend IdentityUser? -



c# - Why Identity 2.0 adds a new column in AspNetUserRoles when I extend IdentityUser? -

i have derived class identityuser, customuser. if check database tables, can see identity 2.0 has added 3rd column aspnetuserroles table, called customuser_id.

it seems foreign key customuser table, aspnetuserroles has userid column, seems redundant.

why? missing?

i'm assuming you've got applicationuser hanging around. identityuser abstract class, column in dbo.aspnetuserroles attached whatever concrete class used tuser type generic identitydbcontext<tuser>. default, that's applicationuser. if created subclass of identityuser, you've done create class similar properties, 1 totally disconnected identity stuff , has own table, dbo.customusers probably, requires separate foreign key added on dbo.aspnetuserroles it.

long , short, 1 bite @ user apple. if want have different types of users, need inherit main user implementation (applicationuser default), not identityuser.

c# asp.net-mvc asp.net-identity

No comments:

Post a Comment