I currently have a database that consist of many linked objects.
Simplified with less objects:
Song => Versions => Info
||
\/
Data
Now I understand that I can eager load all these objects when using
db.Song.include("Versions.Data").Include("Versions.Info").ToList();
However, when I just want 1 song with its data this will cause to load all the songs and all the references.
Is there an easier way like :
db.Song.First().include("Versions.Data").Include("Versions.Info")
Or do I really have to use:
Song.Versions.Load();
foreach( Version version in versions)
{
version.DataReference.Load();
version.InfoReference.Load();
}
It is doable if you have a few related objects, but I am having like 10 objects that have subojects themselves too...
Please show me a better way.