Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
Multiple User types and Identity

In my project, I am currently working on user roles (claims) and registration.

I am struggling with which approach I should use or if there is any source I can base on. I have two types of application users (related to the app's domain), let's say they are Lecturer and Student, these entities differ by a few fields so I wanted to have them separated.

How should I design the entities now?

There are a few cases but I'm not sure how to cover them.

User can be Lecturer

User can be Student

User can be both Lecturer and Student (at the same time)

How do I manage that?

I was thinking about adding a foreign key to each entity (Lecturer/Student/AnyOtherType) to reference IdentityUser and during the registration define the type of user by claims

userIdentity.AddClaim(new Claim(ClaimTypes.Role, "Lecturer"))
userIdentity.AddClaim(new Claim(ClaimTypes.Role, "Student"));

Do you think it is a good idea? How to handle incoming requests based on user role? I know I can use something similar to the following example in some Services, but ideally, I would like to avoid unnecessary calls to the DB just to filter out the needed data in the Service

user.IsInRole("lecturer")

I'm focusing on DDD rn.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda