private void ChangeState(ThreadCreated threadCreated) { var state = this.State.Clone(new { TotalThread = this.State.TotalThread + 1, LatestThreadId = threadCreated.Id }); OnEventHappened(new ForumStateChanged(Id, state)); }
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"); } }