Exemple #1
0
        protected T WaitForRequestCompletion <T>(string baseUri, string statusUrl)
        {
            T obj;

            try
            {
                long timeoutCount = 0;

                long asyncTimeout = 1800; // seconds
                if (_settings["AsyncTimeout"] != null)
                {
                    long.TryParse(_settings["AsyncTimeout"], out asyncTimeout);
                }
                asyncTimeout *= 1000;         // convert to milliseconds

                int asyncPollingInterval = 2; // seconds
                if (_settings["AsyncPollingInterval"] != null)
                {
                    int.TryParse(_settings["AsyncPollingInterval"], out asyncPollingInterval);
                }
                asyncPollingInterval *= 1000; // convert to milliseconds

                WebHttpClient client        = CreateWebClient(baseUri);
                RequestStatus requestStatus = null;

                while (timeoutCount < asyncTimeout)
                {
                    requestStatus = client.Get <RequestStatus>(statusUrl);

                    if (requestStatus.State != State.InProgress)
                    {
                        break;
                    }

                    Thread.Sleep(asyncPollingInterval);
                    timeoutCount += asyncPollingInterval;
                }

                if (requestStatus.State != State.Completed)
                {
                    throw new Exception(requestStatus.Message);
                }

                if (typeof(T) == typeof(string))
                {
                    obj = (T)Convert.ChangeType(requestStatus.ResponseText, typeof(T));
                }
                else
                {
                    obj = Utility.Deserialize <T>(requestStatus.ResponseText, true);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
                throw ex;
            }

            return(obj);
        }
Exemple #2
0
        public IActionResult get_wx_order()
        {
            APIReturn apiReturn = null;
            WebParams ciac      = new WebParams(Request);

            ciac.Add("action", "wxpayms_getordid");
            CallResult cr = WebHttpClient.InvokeHttp("if2017", "dk", "wxpayms_getordid", HttpMethod.Get, ciac);

            if ((cr.Code != 0) || string.IsNullOrEmpty(cr.Message))
            {
                return(this.FuncResult(new APIReturn(10000, cr.Message)));
            }
            string[] msgs = cr.Message.Split(',');
            if ((int.Parse(msgs[0]) != 0) || (msgs.Length != 9))
            {
                return(this.FuncResult(new APIReturn(10000, string.Format($"{cr.Code}:{cr.Message}"))));
            }
            if (ciac["image"] == "image")
            {
                MemoryStream ms = new MemoryStream();
                GetQRCode(msgs[8], ms);
                ArraySegment <byte> data = new ArraySegment <byte>();
                ms.TryGetBuffer(out data);
                string str15 = Convert.ToBase64String(data.Array);
                msgs[8] = str15;
            }
            Hashtable ht = new Hashtable();

            ht["orderid"] = msgs[1];
            ht["code"]    = msgs[8];
            apiReturn     = new APIReturn(0, "", ht);
            return(this.FuncResult(apiReturn));
        }
Exemple #3
0
        public static void PostQueryAsMultipartMessage(string baseUri, string sparql, WebCredentials targetCredentials, WebProxyCredentials proxyCredentials)
        {
            try
            {
                string           result         = string.Empty;
                MultiPartMessage requestMessage = new MultiPartMessage
                {
                    name    = "update",
                    type    = MultipartMessageType.FormData,
                    message = sparql,
                };

                List <MultiPartMessage> requestMessages = new List <MultiPartMessage>
                {
                    requestMessage
                };

                WebHttpClient webClient = new WebHttpClient(baseUri, targetCredentials.GetNetworkCredential(), proxyCredentials.GetWebProxy());

                string response = String.Empty;
                webClient.PostMultipartMessage("", requestMessages, ref response);
            }
            catch (Exception exception)
            {
                _logger.Error("Error in PostQueryAsMultipartMessage: " + exception);
                throw exception;
            }
        }
        public FacadeRepository()
        {
            NameValueCollection settings  = ConfigurationManager.AppSettings;
            ServiceSettings     _settings = new ServiceSettings();

            _settings.AppendSettings(settings);

            #region initialize webHttpClient for converting old mapping
            string proxyHost = _settings["ProxyHost"];
            string proxyPort = _settings["ProxyPort"];

            string facadeServiceUri = _settings["FacadeServiceUri"];
            if (facadeServiceUri.EndsWith("/"))
            {
                facadeServiceUri = facadeServiceUri.Remove(facadeServiceUri.Length - 1);
            }

            if (!string.IsNullOrEmpty(proxyHost) && !string.IsNullOrEmpty(proxyPort))
            {
                WebProxy webProxy = _settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                _facadeServiceClient = new WebHttpClient(facadeServiceUri, null, webProxy);
            }
            else
            {
                _facadeServiceClient = new WebHttpClient(facadeServiceUri);
            }
            #endregion
        }
Exemple #5
0
        protected WebHttpClient CreateWebClient(string baseUri)
        {
            WebHttpClient client = null;

            if (!String.IsNullOrEmpty(_proxyHost) && !String.IsNullOrEmpty(_proxyPort))
            {
                WebProxy webProxy = _settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                client = new WebHttpClient(baseUri, null, webProxy);
            }
            else
            {
                client = new WebHttpClient(baseUri);
            }

            if (AuthHeaders != null && AuthHeaders.Count > 0)
            {
                _logger.Debug("Injecting authorization [" + AuthHeaders.Count + "] headers.");
                client.Headers = AuthHeaders;
            }
            else
            {
                _logger.Debug("No authorization headers.");
            }

            return(client);
        }
        public string UpdateBinding(string scope, string application, string dataLayer)
        {
            string obj = null;

            try
            {
                XElement binding = new XElement("module",
                                                new XAttribute("name", string.Format("{0}.{1}", scope, application)),
                                                new XElement("bind",
                                                             new XAttribute("name", "DataLayer"),
                                                             new XAttribute("service", "org.iringtools.library.IDataLayer, iRINGLibrary"),
                                                             new XAttribute("to", dataLayer)
                                                             )
                                                );

                WebHttpClient client = CreateWebClient(_adapterServiceUri);
                obj = client.Post <XElement>(String.Format("/{0}/{1}/binding", scope, application), binding, true);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.ToString());
            }

            return(obj);
        }
Exemple #7
0
        public Response PostDictionaryToAdapterService(string projectName, string applicationName)
        {
            StringBuilder relativeUri = new StringBuilder();
            string        filePath    = WebConfigurationManager.AppSettings["DbDictionaryFullFilePath"];
            StringBuilder filename    = new StringBuilder();

            filename.Append(filePath);
            filename.Append("DatabaseDictionary.");
            filename.Append(projectName);
            filename.Append(".");
            filename.Append(applicationName);
            filename.Append(".xml");

            relativeUri.Append("/");
            relativeUri.Append(projectName);
            relativeUri.Append("/");
            relativeUri.Append(applicationName);
            relativeUri.Append("/dbdictionary");

            DatabaseDictionary dbDictionary = Utility.Read <DatabaseDictionary>(filename.ToString());
            WebHttpClient      httpClient   = new WebHttpClient(adapterServiceUri, null);
            Response           response     = httpClient.Post <DatabaseDictionary, Response>(relativeUri.ToString(), dbDictionary, true);

            return(response);
        }
        public List <Dictionary <string, string> > GetSecurityGroups()
        {
            List <Dictionary <string, string> > dicSecuritygroups = null;

            try
            {
                WebHttpClient    client   = CreateWebClient(_adapterServiceUri);
                PermissionGroups lstgroup = client.Get <PermissionGroups>("/groups");

                dicSecuritygroups = new List <Dictionary <string, string> >();
                Dictionary <string, string> dicobj = null;
                foreach (string group in lstgroup)
                {
                    dicobj = new Dictionary <string, string>();
                    dicobj.Add("permission", group);
                    dicSecuritygroups.Add(dicobj);
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.ToString());
                throw;
            }

            return(dicSecuritygroups);
        }
Exemple #9
0
        public IActionResult get_wx_order_state([FromQuery] string orderid)
        {
            APIReturn apiReturn = null;

            if (string.IsNullOrEmpty(orderid))
            {
                apiReturn = new APIReturn(10000, $"参数不正确orderid={orderid}");
                return(this.FuncResult(apiReturn));
            }
            List <object> listobj = new List <object>();
            CallResult    cr      = WebHttpClient.InvokeHttp("if2017", "dk", "wxpayms_getordid", HttpMethod.Get, new object[] { "orderid", orderid, "action", "wxpaystate" });

            if (cr.Code == 0 || !string.IsNullOrEmpty(cr.Message))
            {
                char[]   separator = new char[] { '|' };
                string[] strArray  = cr.Message.Split(separator);
                if ((int.Parse(strArray[0]) == 0) && (cr.Message.Length > 2))
                {
                    apiReturn = new APIReturn(0, cr.Message.Substring(2));
                    return(this.FuncResult(apiReturn));
                }
            }
            apiReturn = new APIReturn(196021, $"获取订单状态失败code={cr.Code},message={cr.Message}");
            return(this.FuncResult(apiReturn));
        }
Exemple #10
0
        ///Done by: Ganesh Bisht: Polaris
        /// <summary>
        /// Used for uploading the file to the server
        /// </summary>
        /// <param name="scope">scope name</param>
        /// <param name="application">application name</param>
        /// <param name="inputFile">input file stream</param>
        /// <param name="filename">filename</param>
        /// <returns>response with status and message</returns>
        public Response PostFile(string scope, string application, Stream inputFile, string filename)
        {
            try
            {
                var reluri = String.Format("/{0}/{1}/upload", scope, application);

                WebHttpClient client = CreateWebClient(_adapterServiceUri);
                client.Timeout = -1;
                Response response = Utility.Deserialize <Response>(client.PostStreamUpload(reluri, inputFile, filename), true);
                return(response);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);

                Response response = new Response()
                {
                    Level    = StatusLevel.Error,
                    Messages = new Messages {
                        ex.Message
                    }
                };

                return(response);
            }
        }
		public RemoteProvider(WebHttpClient<IQueryService> client)
		{
			this.client = client;
			this.visitor = new StripQuoteVisitor();
			this.resolver = new TypeResolver(assemblies: null, knownTypes: client.knownTypes ?? new Type[0]);
			CustomExpressionXmlConverter queryconverter = new QueryExpressionXmlConverter(creator: null, resolver: resolver);
			CustomExpressionXmlConverter knowntypeconverter = new KnownTypeExpressionXmlConverter(resolver);			
			this.serializer = new ExpressionSerializer(resolver, new CustomExpressionXmlConverter[] { queryconverter, knowntypeconverter });
		}
Exemple #12
0
        static void Main(string[] args)
        {
            string baseUrl     = String.Empty;
            string relativeUrl = String.Empty;
            string filePath    = String.Empty;
            string mimeType    = String.Empty;
            string Scope       = string.Empty;
            string App         = string.Empty;

            try
            {
                string fileName = string.Empty;
                if (args.Length >= 6)
                {
                    baseUrl     = args[0];
                    relativeUrl = args[1];
                    filePath    = args[2];
                    mimeType    = args[3];
                    Scope       = args[4];
                    App         = args[5];

                    FileInfo info = new FileInfo(filePath);

                    Stream stream = Utility.ReadStream(filePath);

                    WebHttpClient webClient = new WebHttpClient(baseUrl);

                    fileName = Scope + "." + App + "." + info.Name; // Saving file as {Scope}.{App}.fileName
                    MultiPartMessage message = new MultiPartMessage // so that It can be easily identified during download.
                    {
                        fileName = fileName,                        //info.Name,
                        message  = stream,
                        mimeType = mimeType,
                        type     = MultipartMessageType.File
                    };

                    List <MultiPartMessage> requestMessages = new List <MultiPartMessage>
                    {
                        message,
                    };

                    string responseTxt = webClient.PostMultipartMessage(relativeUrl, requestMessages, true);

                    Console.WriteLine(responseTxt);

                    Console.ReadKey();
                }
                else
                {
                    Console.WriteLine(HELP_MESSAGE);
                }
            }
            catch (Exception ex)
            {
            }
        }
        public string UpdateScope(string oldName, string displayName, string newDescription, string cacheDBConnStr, string permissions)
        {
            string obj = null;

            try
            {
                List <string> groups = new List <string>();
                if (permissions.Contains(","))
                {
                    string[] arrstring = permissions.Split(',');
                    groups = new List <string>(arrstring);
                }
                else
                {
                    groups.Add(permissions);
                }
                ScopeProject scope = new ScopeProject()
                {
                    Name          = oldName,
                    DisplayName   = displayName,
                    Description   = newDescription,
                    Configuration = new org.iringtools.library.Configuration()
                    {
                        AppSettings = new AppSettings()
                    },
                    PermissionGroup = new PermissionGroups()
                };
                if (!string.IsNullOrEmpty(permissions))
                {
                    scope.PermissionGroup.AddRange(groups);
                }

                if (!String.IsNullOrWhiteSpace(cacheDBConnStr))
                {
                    scope.Configuration.AppSettings.Settings = new List <Setting>()
                    {
                        new Setting()
                        {
                            Key   = "iRINGCacheConnStr",
                            Value = cacheDBConnStr
                        }
                    };
                }

                string        uri    = string.Format("/scopes/{0}", oldName);
                WebHttpClient client = CreateWebClient(_adapterServiceUri);
                obj = client.Post <ScopeProject>(uri, scope, true);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.ToString());
                throw;
            }

            return(obj);
        }
Exemple #14
0
        static void DoPost(string adapterServiceUri, string projectName, string applicationName, string dbDictionaryFilePath)
        {
            Console.WriteLine("Posting " + dbDictionaryFilePath + " to iRING Adapter Service...");

            string             relativeUri  = "/" + projectName + "/" + applicationName + "/dbdictionary";
            DatabaseDictionary dbDictionary = Utility.Read <DatabaseDictionary>(dbDictionaryFilePath);
            WebHttpClient      httpClient   = new WebHttpClient(adapterServiceUri, null);
            Response           response     = httpClient.Post <DatabaseDictionary, Response>(relativeUri, dbDictionary, true);

            Console.WriteLine(response.ToString());
        }
        /// <summary>
        /// make request with RemoteProvider
        /// </summary>
        static void Test2()
        {
            var                   client    = new WebHttpClient <IQueryService>(baseAddress);
            IQueryProvider        provider  = new RemoteProvider(client);
            Query <Customer>      query     = new Query <Customer>(provider);
            IQueryable <Customer> queryable = from c in ((IQueryable <Customer>)query)
                                              where c.ID > 5 && c.ID < 10
                                              select c;

            List <Customer> results = queryable.ToList();
        }
Exemple #16
0
		/// <summary>
		/// make request with RemoteProvider
		/// </summary>
		static void Test2()
		{
			var client = new WebHttpClient<IQueryService>(baseAddress);
			IQueryProvider provider = new RemoteProvider(client);
			Query<Customer> query = new Query<Customer>(provider);
			IQueryable<Customer> queryable = from c in ((IQueryable<Customer>)query)
											 where c.ID > 5 && c.ID < 10
											 select c;

			List<Customer> results = queryable.ToList();

		}
Exemple #17
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            if (args.Count() > 0)
            {
                string url = args[0];

                string[] seperator =
                {
                    "://",
                    "/",
                    "?",
                    "&",
                    "="
                };

                string[] urlparts = url.Split(seperator, StringSplitOptions.None);

                int partCount = urlparts.Count();

                if (partCount == 0)
                {
                    Console.WriteLine("Invalid Arguments!");
                }
                else
                {
                    //StringBuilder baseUrl = new StringBuilder();
                    //StringBuilder relativeUrl = new StringBuilder();

                    //baseUrl.Append(urlparts[0]);

                    //if (partCount > 1)
                    //{
                    //    baseUrl.Append(urlparts[1]);

                    //    for (int i = 2; i <= partCount - 1; i++)
                    //    {
                    //        relativeUrl.Append(urlparts[i]);
                    //    }
                    //}

                    _logger.Debug("Calling: GET " + url);

                    WebHttpClient webClient = new WebHttpClient(url);

                    string msg = webClient.GetMessage(String.Empty);

                    Console.WriteLine(msg);
                    Console.ReadKey();
                }
            }
        }
Exemple #18
0
 public static DCResult HttpInvoke(string product, DCMethodTypes methodType, string apiName, params object[] datas)
 {
     try
     {
         string     projectName = $"dc_{product.ToLower()}_{methodType.ToString().ToLower()}";
         CallResult callResult  = WebHttpClient.InvokeHttp("dc2016", projectName, apiName, HttpMethod.Get, datas);
         return(new DCResult(callResult));
     }
     catch (Exception ex)
     {
         throw new Exception($"调用DC发生异常({product},{methodType},{apiName})", ex);
     }
 }
Exemple #19
0
 public static ReturnMsg2980 InvokeHttp(string apiName, IDictionary postData)
 {
     try
     {
         var callResult = WebHttpClient.InvokeHttp("dc2016", "2980", apiName, HttpMethod.Get, postData);
         Log.Logger.LogDebug("debug", callResult.Source, callResult.Message);
         return(new ReturnMsg2980(callResult.Message));
     }
     catch (Exception ex)
     {
         throw new Exception("请求2980发生异常", ex);
     }
 }
 public CacheInfo GetCacheInfo(string scope, string app)
 {
     try
     {
         WebHttpClient client       = CreateWebClient(_adapterServiceUri);
         string        relativePath = string.Format("/{0}/{1}/cacheinfo", scope, app);
         return(client.Get <CacheInfo>(relativePath));
     }
     catch (Exception e)
     {
         _logger.Error(e.ToString());
         throw;
     }
 }
Exemple #21
0
        public static ReturnMsgWnt InvokeHttp(string apiName, object json)
        {
            CallResult callResult;

            try
            {
                callResult = WebHttpClient.PostJSON("dc2016", "wnt", apiName, json);
                return(new ReturnMsgWnt(callResult.Message));
            }
            catch (Exception ex)
            {
                throw new Exception("请求wnt发生异常", ex);
            }
        }
Exemple #22
0
        public Response DeleteApp(string projectName, string applicationName)
        {
            StringBuilder relativeUri = new StringBuilder();

            relativeUri.Append("/");
            relativeUri.Append(projectName);
            relativeUri.Append("/");
            relativeUri.Append(applicationName);
            relativeUri.Append("/delete");
            WebHttpClient httpClient = new WebHttpClient(adapterServiceUri, null);
            Response      response   = httpClient.Get <Response>(relativeUri.ToString());

            return(response);
        }
Exemple #23
0
 public NetEase()
 {
     this.webClient = new WebHttpClient();
     this.webClient.AddCookie(new Cookie {
         Name = "appver", Value = "1.5.2", Domain = ".163.com"
     });
     this.webClient.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36";
     this.header = new SafeDictionary <string, string>
     {
         { "Accept", "*/*" },
         { "Accept-Encoding", "" },
         { "Accept-Language", "zh-CN,zh;q=0.8,gl;q=0.6,zh-TW;q=0.4" },
         { "Referer", "http://music.163.com/search/" },
     };
 }
        public List <string> GetTableNames(string scope, string app, Dictionary <string, string> conElts)
        {
            var uri = String.Format("/{0}/{1}/tables", scope, app);

            Request request = new Request();

            foreach (var pair in conElts)
            {
                request.Add(pair.Key, pair.Value);
            }

            WebHttpClient client = CreateWebClient(_hibernateServiceUri);

            return(client.Post <Request, List <string> >(uri, request, true));
        }
        public Response Refresh(string scope, string application, string dataObjectName)
        {
            try
            {
                WebHttpClient client = CreateWebClient(_adapterServiceUri);
                client.Timeout = 600000;

                Response response = client.Get <Response>(String.Format("/{0}/{1}/{2}/refresh", scope, application, dataObjectName));
                return(response);
            }
            catch (Exception e)
            {
                return(PrepareErrorResponse(e, ErrorMessages.errUIRefresh));
            }
        }
Exemple #26
0
        public Collection <ScopeProject> GetScopes()
        {
            Collection <ScopeProject> scopes = new Collection <ScopeProject>();
            string         relativeUri       = "/scopes";
            WebCredentials cred = new WebCredentials();

            try
            {
                WebHttpClient webHttpClient = new WebHttpClient(adapterServiceUri, cred.GetNetworkCredential(), _proxyCredentials.GetWebProxy());
                scopes = webHttpClient.Get <Collection <ScopeProject> >(relativeUri, true);
            }
            catch (Exception ex)
            { }
            return(scopes);
        }
Exemple #27
0
        public ServiceClient(ServiceSettings settings, string baseUri)
        {
            string proxyHost = settings["ProxyHost"];
            string proxyPort = settings["ProxyPort"];

            if (!String.IsNullOrEmpty(proxyHost) && !String.IsNullOrEmpty(proxyPort))
            {
                WebProxy webProxy = settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                _webHttpClient = new WebHttpClient(baseUri, null, webProxy);
            }
            else
            {
                _webHttpClient = new WebHttpClient(baseUri);
            }
        }
        public Response RegenAll()
        {
            try
            {
                WebHttpClient client   = CreateWebClient(_adapterServiceUri);
                Response      response = client.Get <Response>("/generate");
                return(response);
            }
            catch (Exception e)
            {
                _logger.Error(e.ToString());
                return(PrepareErrorResponse(e, ErrorMessages.errUIRegenAll));

                throw;
            }
        }
        public Entity GetClassLabel(string classId)
        {
            Entity entity = new Entity();

            try
            {
                WebHttpClient client = CreateWebClient(_referenceDataServiceUri);
                entity = client.Get <Entity>(String.Format("/classes/{0}/label", classId), true);
            }
            catch (Exception ex)
            {
                _logger.Error(ex.ToString());
                throw;
            }
            return(entity);
        }
Exemple #30
0
 public static string Update(string baseUri, string sparql, WebCredentials targetCredentials, WebProxyCredentials proxyCredentials)
 {
     try
     {
         string        message     = String.Empty;
         string        relativeUri = "?update=" + HttpUtility.UrlEncode(sparql);
         WebHttpClient webClient   = new WebHttpClient(baseUri, targetCredentials.GetNetworkCredential(), proxyCredentials.GetWebProxy());
         message = webClient.GetMessage(relativeUri);
         return(message);
     }
     catch (Exception exception)
     {
         _logger.Error("Error in Update: " + exception);
         throw exception;
     }
 }
        protected WebHttpClient CreateWebClient(string baseUri)
        {
            WebHttpClient client = null;

            if (!String.IsNullOrEmpty(_proxyHost) && !String.IsNullOrEmpty(_proxyPort))
            {
                var webProxy = _settings.GetWebProxyCredentials().GetWebProxy() as WebProxy;
                client = new WebHttpClient(baseUri, null, webProxy);
            }
            else
            {
                client = new WebHttpClient(baseUri);
            }

            return(client);
        }
Exemple #32
0
		static void Test1()
		{				
			//just create a IQueryable to get the Expression:
			IQueryable<Customer> queryable = from c in new Query<Customer>()
											 where c.ID != null && c.ID > 5 && c.ID < 10
											 select c;
			//serialize:
			var serializer = CreateSerializer();
			XElement xmlExpression = serializer.Serialize(queryable.Expression);

			//make direct call to WebHttp service and send the Expression as XML
			//(do not use RemoteProvider).
			var client = new WebHttpClient<IQueryService>(baseAddress);			
			Customer[] result = client.SynchronousCall<Customer[]>((svc) => svc.ExecuteQuery(xmlExpression));
			var count = Enumerable.Count(result); 
		}
        static void Test1()
        {
            //just create a IQueryable to get the Expression:
            IQueryable <Customer> queryable = from c in new Query <Customer>()
                                              where c.ID != null && c.ID > 5 && c.ID < 10
                                              select c;
            //serialize:
            var      serializer    = CreateSerializer();
            XElement xmlExpression = serializer.Serialize(queryable.Expression);

            //make direct call to WebHttp service and send the Expression as XML
            //(do not use RemoteProvider).
            var client = new WebHttpClient <IQueryService>(baseAddress);

            Customer[] result = client.SynchronousCall <Customer[]>((svc) => svc.ExecuteQuery(xmlExpression));
            var        count  = Enumerable.Count(result);
        }
		public void Test2()
		{
			var client = new WebHttpClient<IQueryService>(baseAddress);
			IQueryProvider provider = new RemoteProvider(client);
			Query<Customer> query = new Query<Customer>(provider);
			
			ThreadPool.QueueUserWorkItem(state => 
				{
					IQueryable<Customer> queryable = from c in new Query<Customer>()
													 where c.ID <= 30
													 && c.Country == "Spain"
													 || c.ContactTitle == "Owner"
													 select c;

					List<Customer> results = queryable.ToList();
					int count = queryable.Count();
				});
			
		}