Hi, First, here's the code: (edited for brevity)
Student student = repository.Students.Include(x => x.Tariffs);
[MODEL]
public class Student
{
public int Id { get; set; }
public string DisplayName { get; set; }
.....
public virtual ICollection<Tariff> Tariffs { get; set; }
}
[INTERFACE]
public interface IStudentRepository : IDisposable
{
IQueryable<Student> Students { get; }
Student GetStudentByID(int studentId);
void InsertStudent(Student student);
void DeleteStudent(int studentID);
void UpdateStudent(Student student);
void Save();
}
[CONCRETE IMPLEMENTATION OF INTERFACE]
public class StudentRepository : IStudentRepository, IDisposable
{
private dbContext context = new dbContext();
public StudentRepository(dbContext context)
{ this.context = context;}
}
...
Go to the complete details ...