Is there a way to defined .Where inside .Include

c# entity-framework linq

Question

I've got the next model class method:

public IQueryable<TMSSwitch> AllFindServer_Switches(int id        {



return tms.TMSSwitches.Where(c => c.TMSSwitchPorts.Any(a6=>a6.TechnologyID == id))

.Include(a10 => a10.TMSSwitchPorts.Where(a=>a.TechnologyID==id).Select(a=>a.Technology))
.Include(a11 => a11.TMSServer.Technology)
;}

I am difficult to define, though. inside of where. Include, but only select entries from the navigation property, as I need to. However, when this code is executed, the following error will occur:-

The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation propertie

Can somebody give me advise on how to have.Where inside .include ? Thanks

1
2
11/19/2013 10:04:52 AM

Accepted Answer

It seems you cannot sort the children collection in your query. Sort the results after the initial query, or load the kids in a subsequent query.

Zzz-9-ZZZ similar inquiry and response

41
5/23/2017 12:18:17 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow