0
votes

I have a database with all Identity 2.0 tables, AspnetUsers, AspnetRoles, AspNetUserRoles, AspNetUserClaims and AspNetUserLogins.

I want to add couple of columns to AspnetUsers, like first name lastname. i also have couple of other tables that have foreign keys to that table like teachers students and so on. Then i want to create a EF6 model from database

What is the correct way to do it?

The Problem that i have till now is If i try to extend the partial entity class AspnetUsers from IdentityUser, AspnetUsers.UserName hides IdentityUser.UserName and i even cannot register an user. I saw solutions with deleting columns from the model, modifying .tt file or even modifying generated code :) But none of them seems right to me Of course, i can always add a new Users table (like in old membership days), but i liked a lot the code first approach of adding new columns to AspnetUsers table, so i hope there is a solution for database first approach

1

1 Answers

0
votes

You can create your custom user table and can manually set the required identities in claims identity object. Authenticate using owin context to create cookie. There are demerits of aspnet identity that can be handled by custom claims or tokens