First, about my table setup:
Group:
groupId - int
groupName - varchar
Schedule:
scheduleId - int
scheduleName - varchar
Group_Schedules
scheduleId - int/fk to Schedule
groupId - int/fk to Group
I’m using the EF, in the above scenario, no EF entity is created to represent Group_Schedules, instead a collection is added to Group and Schedule tables representing the other end.
I need to get all groups that belong to a schedule and have my return be an IQueryable<Group>. I.e (and no, this doesn’t work because of the way EF generates the bridge table):
var g = from g in context.Groups
where g.Group_Schedule.scheduleId = 1 // This doesn't work because Group_Schedule is a collection of Schedule
select g;
Is there an elegant way to get the data I need?
Both of these will return an
IQueryable<Group>: