internal WebQuery(HttpClient client, Uri relativeAddress, IExpressionToUriConverter converter)
        {
            string resourceBaseAddress = null;
            string resourceFullAddress = Utility.CombineUri(client.BaseAddress.AbsoluteUri, relativeAddress.OriginalString);
            string resourceName        = ExtractResourceName(resourceFullAddress, out resourceBaseAddress);

            this.expression = new ResourceSetExpression(typeof(IOrderedQueryable <T>), null, Expression.Constant(resourceName), typeof(T), null, CountOption.None, null, null);
            this.provider   = new WebQueryProvider(resourceBaseAddress, client, converter);
        }
 internal WebQueryProvider(string resourceBaseAddress, HttpClient client, IExpressionToUriConverter converter)
 {
     // the web query provider is per HTTP client, per converter, and per resource base address.
     // i.e. one can use the same web query provider to query various resources that are exposed at the same
     // base address, using the same http client, and the same expression to URI conversion.
     this.resourceBaseAddress = resourceBaseAddress;
     this.client    = client;
     this.converter = converter;
 }
        /// <summary>
        /// This method create a WebQuery so that you can further construct the linq expression against
        /// a list of objects
        /// </summary>
        /// <typeparam name="T">The type of the object in the list</typeparam>
        /// <param name="client">The http client proxy</param>
        /// <param name="relativeUri">The relative address Uri that represents the resource</param>
        /// <param name="converter">The custom expression to uri converter</param>
        /// <returns>The web query which implements the IQueryable</returns>
        public static WebQuery <T> CreateQuery <T>(this HttpClient client, Uri relativeUri, IExpressionToUriConverter converter)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            if (relativeUri == null)
            {
                throw new ArgumentNullException("relativeUri");
            }

            if (relativeUri.IsAbsoluteUri)
            {
                throw new InvalidOperationException(string.Format(SR.QueryResourceUriMustBeRelative, relativeUri.AbsoluteUri));
            }

            if (converter == null)
            {
                converter = WebExpressionConverter.Instance;
            }

            return(new WebQuery <T> .WebOrderedQuery(client, relativeUri, converter));
        }
        /// <summary>
        /// This method create a WebQuery so that you can further construct the linq expression against
        /// a list of objects
        /// </summary>
        /// <typeparam name="T">The type of the object in the list</typeparam>
        /// <param name="client">The http client proxy</param>
        /// <param name="relativeAddress">The relative address that represents the resource</param>
        /// <param name="converter">The custom expression to uri converter</param>
        /// <returns>The web query which implements the IQueryable</returns>
        public static WebQuery <T> CreateQuery <T>(this HttpClient client, string relativeAddress, IExpressionToUriConverter converter)
        {
            Uri relativeUri = new Uri(relativeAddress, UriKind.Relative);

            return(CreateQuery <T>(client, relativeUri, converter));
        }
 internal WebOrderedQuery(HttpClient client, Uri resourceAddress, IExpressionToUriConverter converter)
     : base(client, resourceAddress, converter)
 {
 }