コード例 #1
0
        /// <summary>
        /// 设置Api行为返回的任务异常 
        /// 设置失败则返远程异常对象
        /// </summary>   
        /// <param name="taskSetActionTable">任务行为表</param>
        /// <param name="requestContext">请求上下文</param>     
        /// <returns></returns>
        public static RemoteException SetApiActionTaskException(TaskSetActionTable taskSetActionTable, RequestContext requestContext)
        {
            var message = JObject.TryCast<string>(requestContext.Packet.body);
            var taskSetAction = taskSetActionTable.Take(requestContext.Packet.id);

            if (taskSetAction != null)
            {
                taskSetAction.SetAction(SetTypes.SetReturnException, message);
                return null;
            }
            return new RemoteException(message);
        }
コード例 #2
0
 /// <summary>
 /// 设置Api行为返回的任务结果
 /// </summary>
 /// <param name="requestContext">上下文</param>
 /// <param name="taskSetActionTable">任务行为表</param>
 public static void SetApiActionTaskResult(RequestContext requestContext, TaskSetActionTable taskSetActionTable)
 {
     var taskSetAction = taskSetActionTable.Take(requestContext.Packet.id);
     if (taskSetAction != null)
     {
         var returnValue = requestContext.Packet.body;
         taskSetAction.SetAction(SetTypes.SetReturnReult, returnValue);
     }
 }