I'm playing with the Onion Architecture and I got a bit confused about how the Domain Entities are designed.
Let's say I have a chat application that has Post
, Comment
entities.
The domain entities I imagine would look like this:
class Post {
id: string;
text: string;
comments: Comment[];
}
class Comment {
id: string;
text: string;
post: Post;
}
So this gave me a few questions:
- Is it correct to define relationships in the domain entities?
- Or is it better to not have any relationships in the domain entities?
- Where should I implement the
postComment
/createPost
methods and what arguments will they accept?
Aucun commentaire:
Enregistrer un commentaire