I’ll use a blog post as an example.
BlogPost entity is an aggregate root, and it contains a
That’s good because a post comment cannot exist without a parent blog post. Every operation on a
BlogPostComment is taken care of by a
BlogPost, or better by the service which manages
However, by taking this route, every time I want to add a comment, I’m forced to retrieve all the blog post information. Every time I want to remove a comment, I’m forced to retrieve all the blog post information. Etc.
So the first and most obvious solution would be to offer a separate service to operate on
BlogPostComment(s). But that would violate the concept of a post comment. You shouldn’t be able to operate on comments alone.
What’s the right way to do this?