I have the following models
public class Parent
{
public int Id { get; set; }
public string Name { get; set; }
public virtual List<Child> Child { get; set; }
}
public class Child
{
public int Id { get; set; }
public string Name { get; set; }
public virtual List<GrandChild> GrandChild { get; set; }
}
public class GrandChild
{
public int Id { get; set; }
public string Name { get; set; }
}
What Im trying to do now is select a list of parents from the database with the children and grandchildren.
Tried the following with no joy:
List<Parent> parent = new List<Parent>();
parent = db.parent.ToList();