C#C
C#10mo ago
N_58

Should I use navigation properties in EF Core?

When using EF Core should I always use navigation properties or never?
for example I have:
class Post
{
  public string Content { get; set; }
  public string AuthorId { get; set; }
  public User Author { get; set; } // Should I use it?
}


class User
{
  public string Name { get; set; }
  public ICollection<Post> Posts { get; set; } // Should I use it?
}


I use .NET 9 in my smaller project and I wonder if it's better to use it or not in terms of performance?
Was this page helpful?