D
D
dgash22012021-07-06 21:15:45
C++ / C#
dgash2201, 2021-07-06 21:15:45

How to implement a one to one relationship in Entity Framework?

Hello! I have 3 entities User, Mentor and Student. Mentor and User have a one-to-one relationship, Student and User also have a one-to-one relationship. Also, they must have the same Id. That is, when we want to add a Mentor object, there must already be a User object with the same Id. Also with Student.
But how can this be done? I'm just new to Entity Framework

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2021-07-06
@dgash2201

Read - everything is well written here .
From the point of view of the database architecture, if there is a one-to-one relationship, then it might make sense to combine the data into one table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question