|
|
|
|
|
by UK-AL
3280 days ago
|
|
This is solved by DDD and aggregates. Here's how i would do it. Course - Aggregate Root
Student - Aggregate Root
RegisteredCourses[RegisteredCourse[]) - Sub Entity Collection - with id reference to course. With metadata like date time when the registration occurred.
RegisterForCouse Method
There should be no mutable public properties, internal methods should be private. Everything should go through an aggregate root method. |
|
CourseRegistration.ViewCoursesFor(student);
I think giving either entity "ownership" of the relation is a disaster waiting to happen. I just have this vision of someone wanting data about students accidentally loading all the course information. In the DAL of course you end up modelling however but seeing courses in a student just makes me ill.