Пример #1
0
        /// <summary>
        /// Get url query.
        /// </summary>
        /// <returns></returns>
        public string GetUrlQuery()
        {
            if (this.UrlQueryEmpty)
            {
                return(null);
            }

            IUrlQuery urlQuery = null;

            if (null != this.expandablePropertySet)
            {
                urlQuery = this.expandablePropertySet;
            }

            if (this.requestedProperties.Count == 0)
            {
                return(urlQuery.GetUrlQuery());
            }

            PropertyDefinition[] properties = new PropertyDefinition[this.requestedProperties.Count + this.firstClassProperties.Count];
            int counter = 0;

            // always add first class properties if at least one property added.
            for (int i = 0; i < this.firstClassProperties.Count; i++)
            {
                properties[counter++] = this.firstClassProperties[i];
            }

            for (int i = 0; i < this.requestedProperties.Count; i++)
            {
                properties[counter++] = this.requestedProperties[i];
            }

            SelectQuery selectQuery = new SelectQuery(properties);

            if (null != urlQuery)
            {
                CompositeQuery compositeQuery = new CompositeQuery(new IUrlQuery[] { selectQuery, urlQuery });
                return(compositeQuery.GetUrlQuery());
            }

            return(selectQuery.GetUrlQuery());
        }
Пример #2
0
 /// <summary>
 /// Add query to request.
 /// </summary>
 /// <param name="urlQuery"></param>
 public void AddQuery(IUrlQuery urlQuery)
 {
     urlQuery.ThrowIfNull(nameof(urlQuery));
     this.restUri.AddQuery(urlQuery.GetUrlQuery());
 }