Saturday, December 29, 2018

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?

Foreign Key and fetching it from the database (EF Core) Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team