Esempio n. 1
0
 public Result AsyncRequestByResourceFullPath(RestRequest rest, ExtendParams restExtendParams, string fullpath)
 {
     try
     {
         Result r = AnsyRequest(rest, restExtendParams, fullpath);
         return(r);
     }
     finally
     {
     }
 }
Esempio n. 2
0
 public Result AsyncRequestByResourcePath(RestRequest rest, ExtendParams restExtendParams, string resourcePath)
 {
     try
     {
         this._uri = resourcePath;
         Result r = AnsyRequest(rest, restExtendParams, ApiUr);
         return(r);
     }
     finally
     {
     }
 }
Esempio n. 3
0
 private Result AnsyRequest(RestRequest rest, ExtendParams restExtendParams, string fullpath)
 {
     try
     {
         RestBag rrest = new RestBag();
         rrest.extendParms = restExtendParams;
         rrest.req         = rest;
         rrest.uri         = fullpath;
         Result r = RequestProvider.AnsyRequest(rrest);
         return(r);
     }
     finally
     {
     }
 }
Esempio n. 4
0
        public Result <T> SyncRequestByResourcePath <T>(RestRequest rest, ExtendParams restExtendParams, string resourcePath)
        {
            Result <T> t = new Result <T>();

            try
            {
                this._uri = resourcePath;
                Result r = SyncRequest(rest, restExtendParams, ApiUr);
                t.code      = r.code;
                t.message   = r.message;
                t.errorCode = r.errorCode;
                if (r.code == 0)
                {
                    return(t);
                }
                if (r.code == 1)
                {
                    try
                    {
                        string resultInfo = TryCast.CastTo <string>(r.@object);
                        t = JsonConvert.DeserializeObject <Result <T> >(resultInfo);
                    }
                    catch (Exception ex)
                    {
                        LogService.Default.Fatal("转化TResult 中的T对象出错:对象【" + typeof(T).FullName + "】,转化对象:JSON:" +
                                                 JsonConvert.SerializeObject(t.@object));
                        return(t);
                    }
                }
            }
            catch (Exception ex)
            {
                t.code    = 0;
                t.message = ex.Message;
                return(t);
            }
            finally
            {
            }
            return(t);
        }