Esempio n. 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);
        }
Esempio n. 2
0
 public void Apply(TagStartedEvent evnt)
 {
     _tags.Add(new Tag(evnt.Url, evnt.Title));
 }