Пример #1
0
        public void Handle(BlogStartedEvent evnt)
        {
            var key = KeyUtils.GetStateKey(evnt.AggregateId);

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

            if (state != null)
            {
                throw new Exception("There is a blog with the same host name in the store.");
            }

            state = new BlogState
            {
                Id        = evnt.AggregateId,
                Brand     = evnt.Brand,
                Copyright = evnt.Copyright,
                Avatar    = evnt.Avatar,
                Github    = evnt.Github,
                Twitter   = evnt.Twitter,
                Linkedin  = evnt.Linkedin
            };

            _db.SetObject(key, state);
        }
 public static int Val(this BlogState state)
 {
     return((int)state);
 }