public void SetAuthor(RegisteredUser author) { if (Author != null) { return; } Author = author; author.AddComment(this); }
public Comment(string content, RegisteredUser author) { if (content == null) { throw new ArgumentNullException(nameof(content)); } if (author == null) { throw new ArgumentNullException(nameof(author)); } var snapshot = DateTime.UtcNow; Content = content; CreatedAt = snapshot; LastChangedAt = snapshot; Author = author; author.AddComment(this); }