As the topic says I wonder what is faster and better approach.
Linq and new method in repository like GetCourts(int clubId)
var courts =_context.Courts.Where(c=>c.ClubId==clubId)
Or lazy loading using EF
var courts= _clubRepository.GetClub(clubId).Courts;
My Club entity:
public class Club :EntityBase
{
public string Name { get; set; }
public virtual IList<Court> Courts { get; set; }
}
My Court entity:
public class Court:EntityBase
{
public bool IsIndoor { get; set; }
public int ClubId { get; set; }
public virtual Club Club { get; set; }
public int CourtTypeId { get; set; }
public virtual CourtType CourtType { get; set; }
}
I don't knwo what approach to use in my project.