I need to implement several users with different roles: administrator, normal user, etc., while the administrator, for example, may have additional fields that the user does not have. I just started to learn ASP .NET MVC, and the time is very limited (I am writing a diploma), so I would like to get advice on how to implement this is the easiest way (and how it is done usually). I use Code First. Whether this option is suitable: There is an AspNetUsers table with common fields, with which links are connected 1 - 0..1 AdminInfo and UserInfo tables, in which there are additional fields. Is such a database structure considered normal?
At first I tried to make a hierarchy of classes (AdminInfo and UserInfo are ApplicationUser inheritances) and use the TPT approach (table per type), but got confused when registering, because Identity already has a user creation mechanism. I myself understand that I have little understanding of the topic, but I will be grateful if you indicate in which direction to go.

  • and which add. fields can be at the administrator and other roles? what is this for? - Bald
  • 3
    The easiest way is to leave admin admin. fields for ordinary users are empty. - Pavel Mayorov
  • For example, the user has such fields as age, gender, interests, etc. Since the administrator is not a user of this type in principle, he should not have this data. The administrator only controls other users. And let's say there is a 3rd type of user (the 1st was the student, the 2nd administrator, the 3rd was the teacher). It is clear that the teacher will not have the fields "class", "average score." If it is permissible to leave so many fields empty and does not contradict any norms of database design, then really, probably, this is the simplest solution in my case. - user233529

0