Exemplo n.º 1
0
 /// <summary>
 /// 设置强类型模型结果值
 /// </summary>
 /// <param name="context">上下文</param>
 /// <returns></returns>
 public override async Task SetResultAsync(ApiResponseContext context)
 {
     if (context.ApiAction.Return.DataType.IsRawType == false)
     {
         var resultType = context.ApiAction.Return.DataType.Type;
         context.Result = await context.XmlDeserializeAsync(resultType).ConfigureAwait(false);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 设置强类型模型结果值
        /// </summary>
        /// <param name="context">上下文</param>
        /// <returns></returns>
        public override async Task SetResultAsync(ApiResponseContext context)
        {
            if (context.ApiAction.Return.DataType.IsModelType == false)
            {
                return;
            }

            try
            {
                var resultType = context.ApiAction.Return.DataType.Type;
                context.Result = await context.XmlDeserializeAsync(resultType).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                context.Exception = ex;
            }
        }