示例#1
0
文件: Forum.cs 项目: dev-4-dev/c-es
        private void ChangeState(ThreadCreated threadCreated)
        {
            var state = this.State.Clone(new
            {
                TotalThread    = this.State.TotalThread + 1,
                LatestThreadId = threadCreated.Id
            });

            OnEventHappened(new ForumStateChanged(Id, state));
        }
示例#2
0
 private void Handle(ThreadCreated evnt)
 {
     using (var conn = _connectionFactory.OpenConnection())
     {
         conn.Insert(
             new
         {
             Id         = evnt.Id,
             Subject    = evnt.Subject,
             Body       = evnt.Body,
             ForumId    = evnt.ForumId,
             AuthorId   = evnt.AuthorId,
             Marks      = evnt.Marks,
             Status     = evnt.Status,
             CreateTime = evnt.CreateTime,
             IsStick    = evnt.StickInfo.IsStick,
             StickDate  = evnt.StickInfo.StickDate
         }, "EventSourcing_Sample_Thread");
     }
 }