Reputation: 38465
Ok lets say i have a user table and then a table that logs all login atempts (Id(counter), userId, time and if successful or not)
Now in my Entity Model i want it to be 2 Association's one with the time of all successful attempts and one with all unsuccessful attempts how could i achieve this?
This is how the model looks now!
Upvotes: 3
Views: 519
Reputation: 73112
Good question. :)
What your essentially trying to do is have a condition on your navigational property, like how you have have conditional mapping on your entities.
Unfortunately, Navigational Properties on the conceptual model must map to foreign keys on the physical model (database). And FK's cannot be conditional.
What i would do, is use TPH on UserLoginHistory.
Create two entities - UserLoginHistorySuccess and UserLoginHistoryFail.
And use a dicriminator (Success) to map to the single UserLoginHistory table.
E.g:
That way, you can add two navigational properties on User, which maps to the two entities.
But you still only require 1 actual database table.
More on Table Per Hierachy here.
Good luck!
Upvotes: 3