I have two tables Appointment and TaskAllocation having one to many relationship. now when i get the Appointment
public IEnumerable<Appointment> GetAppointments(int employeeId, DateTime date)
{
return _context.Appointment.Where(a => a.EmployeeId == employeeId &&
a.AppointmentDate == date)
.Include(a=>a.Tasks).ToList();
}
It causes including one appointment with many tasks and again one task with that appointment with many tasks and so on.