EntityFramework User Association

Ok lets say that I have a user table, and then a table in which all login attempts are recorded (Id (counter), userId, time, and if it is successful or not)

Now in my Entity model, I want it to be the 2nd Association with all the successful attempts and one with all the failed attempts, how could I achieve this?

This is what the model looks like now!

alt text

+3
source share
1 answer
Good question.:)

What you are basically trying to do is a condition for your navigational property , for example, how you have conditional matching with your entities .

, ( ). FK .

, TPH UserLoginHistory.

- UserLoginHistorySuccess UserLoginHistoryFail.

dicriminator () UserLoginHistory.

:

  • UserLoginHistorySuccess - UserLoginHistory, Success = 1
  • UserLoginHistoryFail - UserLoginHistory, Success = 0

, , .

- .

.

!

+3

Source: https://habr.com/ru/post/1780113/


All Articles