private void Handle(DomainObjectRemovedEvent <Reply> evnt) { if (this.Id == evnt.DomainObject.TopicId) { this.TotalReplyCount -= 1; } }
} //内容 #endregion #region Event Handlers private void Handle(DomainObjectRemovedEvent <Topic> evnt) { if (this.TopicId == evnt.DomainObject.Id) { Repository.Remove(this); Console.WriteLine(string.Format("删除Topic后,Reply:\"{0}\"被级联删除.", Body)); } }
public void Handle(DomainObjectRemovedEvent <Post> evnt) { this.TotalPosts--; if (evnt.DomainObject.CreateDate == this.UpdateDate) { var posts = Repository.Find <Post, FindPostsEvent>(evt => evt.ThreadId = this.Id); if (posts.Count > 0) { posts.Sort((post1, post2) => DateTime.Compare(post1.CreateDate, post2.CreateDate)); var recentPost = posts[posts.Count - 1]; this.MostRecentReplierId = recentPost.AuthorId; this.UpdateDate = recentPost.CreateDate; } else { this.MostRecentReplierId = Guid.Empty; this.UpdateDate = this.CreateDate; } } }
private void Handle(DomainObjectRemovedEvent <Thread> evnt) { Repository.Remove(this); }