public Discussion(TenantId tenantId, ForumId forumId, DiscussionId discussionId, Author author, string subject, string exclusiveOwner = null)
        {
            AssertionConcern.NotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.NotNull(forumId, "The forum id must be provided.");
            AssertionConcern.NotNull(discussionId, "The discussion id must be provided.");
            AssertionConcern.NotNull(author, "The author must be provided.");
            AssertionConcern.NotEmpty(subject, "The subject must be provided.");

            this.Apply(new DiscussionStarted(tenantId, forumId, discussionId, author, subject, exclusiveOwner));
        }
 public PostedToDiscussion(TenantId tenantIdId, ForumId forumId, DiscussionId discussionId, PostId postId,
     Author author, string subject, string bodyText, PostId replyToPostId)
 {
     this.TenantIdId = tenantIdId;
     this.ForumId = forumId;
     this.DiscussionId = discussionId;
     this.PostId = postId;
     this.Author = author;
     this.Subject = subject;
     this.BodyText = bodyText;
     this.ReplyToPostId = replyToPostId;
 }
        public DiscussionStarted(TenantId tenantId, ForumId forumId, DiscussionId discussionId, Author author,
            string subject, string exclusiveOwner)
        {
            this.TenantId = tenantId;
            this.ForumId = forumId;
            this.DiscussionId = discussionId;
            this.Author = author;
            this.Subject = subject;
            this.ExclusiveOwner = exclusiveOwner;

            this.EventVersion = 1;
            this.OccurredOn = DateTime.Now;
        }
        public Post(TenantId tenantId, ForumId forumId, DiscussionId discussionId, PostId postId, Author author, 
            string subject, string bodyText, PostId replyToPostId=null)
        {
            AssertionConcern.NotNull(tenantId, "The tenant must be provided.");
            AssertionConcern.NotNull(forumId, "The forum id must be provided.");
            AssertionConcern.NotNull(discussionId, "The discussion id must be provided.");
            AssertionConcern.NotNull(postId, "The post id must be provided.");
            AssertionConcern.NotNull(author, "The author must be provided.");

            this.AssertPostContent(subject, bodyText);

            this.Apply(new PostedToDiscussion(tenantId, forumId, discussionId, postId, author, subject, bodyText, replyToPostId));
        }
 private void When(DiscussionStarted e)
 {
     this._tenantId = e.TenantId;
     this._forumId = e.ForumId;
     this._discussionId = e.DiscussionId;
     this._author = e.Author;
     this._subject = e.Subject;
     this._exclusiveOwner = e.ExclusiveOwner;
 }
 public Post Post(ForumIdentityService forumIdentityService, Author author, string subject, string bodyText,
     PostId replyToPostId = null)
 {
     return new Post(this._tenantId, this._forumId, this._discussionId, forumIdentityService.GetNextPostId(),
         author, subject, bodyText, replyToPostId);
 }
 public Discussion StartDiscussionFor(ForumIdentityService forumIdentityService, Author author, string subject,
     string exclusiveOwner=null)
 {
     this.AssertOpen();
     return new Discussion(this._tenantId, this._forumId, forumIdentityService.GetNextDiscussionId(), author,
         subject, exclusiveOwner);
 }
 private void When(PostedToDiscussion e)
 {
     this._tenantId = e.TenantIdId;
     this._forumId = e.ForumId;
     this._discussionId = e.DiscussionId;
     this._postId = e.PostId;
     this._author = e.Author;
     this._subject = e.Subject;
     this._bodyText = e.BodyText;
     this._replyToPostId = e.ReplyToPostId;
 }