Foreign Key and fetching it from the database (EF Core)
Alright, so I have a 'Users' table with a foreign key called 'Key'.
In the model I have:
public Key Key { get; set; }
this works when I create a new user and the KeyId is properly set for the added user.
However, when fetching a user:
_context.Users.FindAsync(userId);
Key is null. Why and how do I fix this?
0 comments:
Post a Comment