コード例 #1
0
        protected override void OnCommand(object cmd)
        {
            switch (cmd)
            {
            case PostMessage postMessage:

                //TODO: Broadcast new message information to hubs/etc
                var newEvent = new MessageIsPostedToFeedEvent()
                {
                    MessageId  = postMessage.Message.MessageId,
                    EmployeeId = postMessage.Message.PostedByEmployeeId,
                    PostedDate = postMessage.Message.DatePosted,
                    Text       = postMessage.Message.Text,
                    Title      = postMessage.Message.Title
                };

                this.Persist(newEvent, this.MessagePosted);
                break;

            case GetMessages msg:
                this.internalFeed.Forward(msg);
                break;

            default:
                this.Unhandled(cmd);
                break;
            }
        }
コード例 #2
0
 private void MessagePosted(MessageIsPostedToFeedEvent e)
 {
     this.internalFeed.Tell(new PostMessage(new Message(e.MessageId, e.EmployeeId, e.Title, e.Text, e.PostedDate)));
 }