示例#1
0
        public async Task <bool> Put <T>(T msg) where T : BaseMessage
        {
            var handler = MessageHandlerFactory.GetHandler(msg);

            if (handler != null)
            {
                return(await handler.Handle());
            }
            else
            {
                throw new NotSupportedException(string.Format("目前不支持类型为 {0} 的消息", msg.MsgType));
            }
        }
        public async Task <BaseMessage> Get(MsgTypes type, int id)
        {
            var handler = MessageHandlerFactory.GetHandler(type);

            return(await handler.Get(id));
        }
        public async Task <bool> Delete(MsgTypes type, int id)
        {
            var handler = MessageHandlerFactory.GetHandler(type);

            return(await handler.Delete(id));
        }
        public async Task <IEnumerable <BaseMessage> > Search(MessageSearchCondition cond)
        {
            var handler = MessageHandlerFactory.GetHandler(cond.MsgType);

            return(await handler.Search(cond));
        }