Entity Framework: One to Many Relationships

I have a design issue regarding Entity Framework model relationship

I have this model in edmx Ef diagram

Business Rule:

A Participantcan have several Roles, so I create a relationship table ParticipantRolesthat has a 1 to many relationship in the table ParticipantandRole

Problem : In order to get the value of the member role, I have to go through Participant->ParticipantRole->Role(see JSON output below)

enter image description here

Question:

In EF, how to create a table relation to traverse the member table. I want to access the role in something like Particant.Role, notParticipant.ParticipantsRole.Role

+4
source share
1

, A Participant Role s. , , Role Participant s. , "--" .

Entity Framework "--" ( ), . , ParticipantsRole , ParticipantId RoleId , ParticipantsRole . Participant.Roles Role.Participants.

ParticipantsRole, . ( , ).

, :

  • ParticipantRoles .
  • ParticipantRoles, FK, .
  • ParticipantsRole "".

"--" .

, . M2m 1-m-1association ( ). , , , . , . m2m 1--1 . - - ...

+2

All Articles