N_58
N_58
Explore posts from servers
CC#
Created by N_58 on 3/17/2025 in #help
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 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?
}
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?
16 replies