I have a simple structure like this
class Host{
Node RootNode;
}
class Node{
Node Parent;
Children ICollection<Node>Children;
}
And I have the model builder as
modelBuilder.Entity<Node>()
.HasOptional(x => x.Parent)
.WithMany(y => y.Children)
.Map(m => m.MapKey("Parent_Id")).WillCascadeOnDelete(false);
However, when I query I do not get the whole tree but just the first child. How can I get the whole tree data loaded. Here is the query.
return db.Host
.Include(l => l.RootNode)