예제 #1
0
 public void SetAuthor(RegisteredUser author)
 {
     if (Author != null)
     {
         return;
     }
     Author = author;
     author.AddComment(this);
 }
예제 #2
0
        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);
        }