private Blog(string title, string subtitle, Guid userId, Guid aggregateId) : this() { var blogCreatedEvent = new BlogCreatedEvent(title, subtitle, DateTime.Now, aggregateId); var userAddedEvent = new UserAddedToBlogEvent(userId, aggregateId); Apply(blogCreatedEvent); Apply(userAddedEvent); }
public void Handle(BlogCreatedEvent createdEvent) { var blogViewItem = new BlogViewItem() { BlogId = createdEvent.AggregateId, BlogTitle = createdEvent.BlogTitle, SubTitle = createdEvent.SubTitle }; _blogViewRepository.Insert(blogViewItem); _blogViewRepository.CommitChanges(); }
private void BlogCreated(BlogCreatedEvent blogCreatedEvent) { AggregateId = blogCreatedEvent.AggregateId; }
protected override void When() { _creationTime = DateTime.Now; _createdEvent = new BlogCreatedEvent("Title", "SubTitle", _creationTime, Guid.Empty); BlogView.Handle(_createdEvent); }