Ejemplo n.º 1
0
 /// <summary>
 /// 参数反序列化
 /// </summary>
 /// <param name="request"></param>
 protected virtual void StructuredPostDataProcess(ref RequestModelType request)
 {
     try
     {
         if (ApiMethodMetaInfo.IsStructuredPost && !string.IsNullOrEmpty(PostData))
         {
             request = JsonConvertExd.Deserialize <RequestModelType>(PostData);
         }
     }
     catch (Exception ex)
     {
         throw new ApiException(ApiResultCode.ParamsError)
               {
                   ErrorMessage = "提交数据存在异常:" + ex.Message
               };
     }
 }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";

            context.Response.Write(JsonConvertExd.SerializeObject(WebBaseUtil.ApiMethodMetaCache.Select(c => c.Value)));
        }
Ejemplo n.º 3
0
 public override string CustomOutputFun(ApiRequestModelBase request, NormalResponseModel response)
 {
     return(JsonConvertExd.SerializeObject(WebBaseUtil.ApiMethodMetaCache.Where(x => x.Value.APIMethodDesc.IsShow).Select(c => c.Value)));
 }
Ejemplo n.º 4
0
 public string OutPut <ResponseModel>(ResponseModel model, List <string> ingoreList)
 {
     return(JsonConvertExd.SerializeObjectWithIgnore(model, ingoreList));
 }
Ejemplo n.º 5
0
 public string OutPut <ResponseModel>(ResponseModel model)
 {
     return(JsonConvertExd.SerializeObject(model));
 }
 public string OutPut <RequestModelType>(RequestModelType request)
 {
     return(JsonConvertExd.SerializeObject(request));
 }
Ejemplo n.º 7
0
        public override string CustomOutputFun(ApiRequestModelBase request, NormalResponseModel response)
        {
            var message = new { message = "WelCome to OpenAPI!" };

            return(JsonConvertExd.SerializeObject(message));
        }
Ejemplo n.º 8
0
 public string OutPut <RequestModelType>(RequestModelType request, List <string> ingoreList)
 {
     return(JsonConvertExd.SerializeObjectWithIgnore(request, ingoreList));
 }