假设我有一个BlogPost聚合根.它拥有一份清单<Comment>.
BlogPost AddComment签名应如何显示?可以使用:
public void AddComment(Comment comment)
{
Comments.Add(comment);
}
或者我应该避免在其之外创建对root用户的引用,并执行以下操作:
public void AddComment(string text, string email)
{
Comment comment = new Comment(text, email);
Comments.Add(comment);
}