예제 #1
0
파일: Blog.cs 프로젝트: mastoj/NBlog
 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);
 }
예제 #2
0
파일: BlogView.cs 프로젝트: mastoj/NBlog
 public void Handle(BlogCreatedEvent createdEvent)
 {
     var blogViewItem = new BlogViewItem()
                            {
                                BlogId = createdEvent.AggregateId,
                                BlogTitle = createdEvent.BlogTitle,
                                SubTitle = createdEvent.SubTitle
                            };
     _blogViewRepository.Insert(blogViewItem);
     _blogViewRepository.CommitChanges();
 }
예제 #3
0
파일: Blog.cs 프로젝트: mastoj/NBlog
 private void BlogCreated(BlogCreatedEvent blogCreatedEvent)
 {
     AggregateId = blogCreatedEvent.AggregateId;
 }
예제 #4
0
 protected override void When()
 {
     _creationTime = DateTime.Now;
     _createdEvent = new BlogCreatedEvent("Title", "SubTitle", _creationTime, Guid.Empty);
     BlogView.Handle(_createdEvent);
 }