I\'ve looked at the 101 Linq Samples here but I can\'t see anything like this in that list. If I\'m just not seeing a relevant example there, please link to it.
If I ha
Not an explicit answer, but perhaps implicitly helpful building your system.
Have you considered a richer domain model like so:
class Student { int id; string name; IEnumerable enrolments }
class Course { int id, string name; }
class Enrolment { Student student; Course course; }
?
The Student class could then have a method GetEnroledCourses() like so:
public IEnumerable GetEnroledCourses()
{
return enrolements.Select(enrolement => enrolement.Course).ToList().AsReadonly();
}
A model that's merely a one-to-one mapping to the database suffice in some contexts, but if you have complex business logic such an «anemic domain model» might bite you.