, powiedzmy, że mam główny katalog BlogPost. posiada listę <Comment>
.
Jak powinien wyglądać podpis BlogPost AddComment? Czy można użyć:Jak dodać obiekt do kolekcji utrzymywanej przez agregat root
public void AddComment(Comment comment) { Comments.Add(comment); }
lub należy unikać tworzenia odniesień do dzieci root poza nim, i zrobić coś takiego:
public void AddComment(string text, string email) { Comment comment = new Comment(text, email); Comments.Add(comment); }