I would like to create a more structured approach for loading the required entity tree:
I need a serious amount of data, so I do this using the type of safe inclusions (only regular Include, but with Lambda) as shown here .
As I said, I need a lot of data, basically the whole tree of objects under one parent element.
Now I could do this by doing something like:
context.House
.Include(x => x.Doors)
.Include(x => x.Doors.FirstOrDefault().Joint)
.Include(x => x.Doors.FirstOrDefault().Joint.FirstOrDefault().JointCategory)
.Include(x => x.Doors.FirstOrDefault().Joint.FirstOrDefault().JointCategory.JointType)
.Include(x => x.Windows)
.Include(x => x.Roof)
As you can see, this line filled with inclusion can become quite huge. This is actually a very simplified sample of actual code (which does not include btw at home)
, , . , , " ". , , .
, , :
public void LoadHouse(int id)
{
ObjectQuery<House> query = context.House;
LoadDoors(query, x => x.Door);
}
public void LoadDoors<T>(ObjectQuery<T> query, ..?..)
{
LoadJoints(...)
}
. ... .
- - ? - ?