DDD Topic - Lesson association AggregateRoot

262 Views Asked by At

I'm new in DDD. I have a Topic entity and Lesson entity. Topic has many Lessons. I need to add/remove Topics as well as Lessons. Should i create two different repositories for entities, or just one TopicRepository which handles all the lessons? Is this a classic Order - OrderItem model?

Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

If both entites makes sense without eachother, then go for the two different repositories.

If you delete a topic, should you then delete all lessons associated with this topic? If, yes .. then You got yourself a TopicRepository handling both topics and lessons.

If no, you have two repositories.

1
On

Do Lessons make any sense without Topics? if not, then yes, this is very much like Order - OrderItem.