Esempio n. 1
0
        private void AddQueryString(StringBuilder uriBuilder, JsonObject parameters)
        {
            if (parameters != null)
            {
                if (UriTemplate.IndexOf('?') < 0)
                {
                    uriBuilder.Append("?");
                }

                foreach (var param in parameters)
                {
                    string name  = param.Key;
                    object value = param.Value;

                    if (ConsumedInBaseUri(name))
                    {
                        continue;
                    }

                    if (value is Delegate)
                    {
                        // Ignore callbacks in the async scenario.
                        continue;
                    }

                    if (value is JsonObject)
                    {
                        // Nested object... use name.subName=value format.
                        foreach (KeyValuePair <string, object> nestedParam in (IDictionary <string, object>)value)
                        {
                            uriBuilder.AppendFormat("&{0}.{1}={2}",
                                                    name, nestedParam.Key,
                                                    FormatUriParameter(nestedParam.Value));
                        }

                        continue;
                    }

                    uriBuilder.AppendFormat("&{0}={1}", name, FormatUriParameter(value));
                }
            }
        }