/Source/Samples/Blog/Bifrost.Samples.Blog.Views/Blogs/BlogEventSubscriber.cs

# · C# · 29 lines · 25 code · 4 blank · 0 comment · 0 complexity · c1cf2e37f0642e77bac152af8b7c22d8 MD5 · raw file

  1. using Bifrost.Events;
  2. using Bifrost.Samples.Blog.Events.Blogs;
  3. namespace Bifrost.Samples.Blog.Views.Blogs
  4. {
  5. public class BlogEventSubscriber : EventSubscriber<Blog>
  6. {
  7. public void Process(BlogCreated @event)
  8. {
  9. var blog = new Blog {Id = @event.EventSourceId};
  10. InsertEntity(blog);
  11. }
  12. public void Process(BlogNameSet @event)
  13. {
  14. UpdateProperty(@event, b => b.Name = @event.BlogName);
  15. }
  16. public void Process(BlogTagLineSet @event)
  17. {
  18. UpdateProperty(@event, b => b.TagLine = @event.TagLine);
  19. }
  20. public void Process(BlogOwnerAssigned @event)
  21. {
  22. UpdateProperty(@event, b => b.Owner = @event.Owner);
  23. }
  24. }
  25. }