Example:
I have two bounded contexts Exams
and Courses
. The Exams context has a Student
entity that has information about the students to take an exam. And the Courses context has a teachers entity that contains information about the teacher teaching a course.
I also have an AuthService
(purely CRUD), that is used for Authentication and Authorisation of users. The AuthService
has an Accounts
entity, which contains information like accounts user's name, address, phone number e.t.c.
Bringing them all together, The Student
and the Teacher
both have Accounts hence their information is already available.
I have a couple of question about this.
- Is it anti-pattern in DDD to store the AccountId in the Student and Teachers Entity? If it isn't anti-pattern at what point is it ok to collect students account information using the AccountId, In repository or in the API controller, or should we use RPC/API calls.
- Is it okay to copy the details needed from the Account entity into a Student or Teacher Entity?