score:1

try it like this. you might need to change some of the "select" and "selectmany" options and the id field names as you did not post the context.`

var query = _context.equipment.include(x => x.group)
            .include(x => x.status)
            .include(x => x.area)
            .include(x => x.equipmenttype)
            .include(x => x.notes)
            .include(x => x.department)
            .include(x => x.pmaintenance)
            .include(x => x.maintenancehours)
            .include(x => x.attachments)
            .include(x => x.request).firstordefault(x => x.equipmentid == id);

            query.include(x => x.parts).theninclude(x => x.childrenparts).selectmany(x => x.parts).where(a => query.select(q => q.partsid).contains(a.id)).load();
            query.selectmany(x => x.parts).selectmany(x => x.childrenparts).load();
            query.selectmany(x => x.parts).selectmany(x => x.parentparts).load();
            query.selectmany(x => x.parts).select(x => x.vendor).load();
            query.include(x => x.systeminfo).theninclude(x => x.systemusers).selectmany(x => x.systeminfo).where(a => query.select(q => q.systeminfoid).contains(a.id)).load();
            query.selectmany(x => x.systeminfo).selectmany(x => x.frameworks).load();
            query.selectmany(x => x.systeminfo).selectmany(x => x.videocards).load();
            query.selectmany(x => x.systeminfo).selectmany(x => x.storagedrives).load();
            query.selectmany(x => x.systeminfo).selectmany(x => x.software).load();
            query.selectmany(x => x.systeminfo).selectmany(x => x.networkadapters).load();
            query.selectmany(x => x.systeminfo).selectmany(x => x.printers).load();

            query.tolist();

hope this helps.


Related Query

More Query from same tag