예제 #1
0
        public void Handle(TagStartedEvent evnt)
        {
            var key = KeyUtils.GetStateKey(evnt.AggregateId);

            var state = _db.GetObject <BlogState>(key);

            if (state == null)
            {
                throw new Exception("Blog has to be started first.");
            }

            var tag = new TagState
            {
                TagUrl   = evnt.Url,
                TagTitle = evnt.Title
            };

            state.Tags.Add(tag);

            _db.SetObject(key, state);
        }
예제 #2
0
 public void Apply(TagStartedEvent evnt)
 {
     _tags.Add(new Tag(evnt.Url, evnt.Title));
 }