i'm struggling writing query in entity framework deals many many relationship have set up. want items tablea belong relationship tableb , @ same time know results relationship correct match.
for instance, if i'm using students , courses, want students in set of courses , return courses matched. want start query students, can accomplished looking @ courses navigation property list of students.
what want list of students each student contains set of courses in query (not every course student taking).
something below close, correct list of students, navigation property courses shows courses, not subset query. want avoid having query again if possible, , return set of students / courses need.
dim listofstudents = s in students c in s.courses listofcourseids.contains(c.courseid)
if there's no junction table between two, try:
from s in dc.students c in s.courses c.courseid == courseid select s;
if entity has junction table between two, try:
from s in dc.students e in s.studentscourses e.course.courseid == courseid select s;
Comments
Post a Comment