示例#1
0
        /// <summary> Return the query as JSON url, e.g. "Customer?{where:{FirstName:'Maria'}}" </summary>
        private string GetJsonResourcePath(string resourceName)
        {
            var json = JsonQueryExpressionVisitor.Translate(this.Expression);

            if (json.Length > 2)
            {
                // TODO may be able to get away with not escaping the URI
                var uri = Uri.EscapeUriString(json);
                return(resourceName + '?' + uri);
            }
            else
            {
                return(resourceName);
            }
        }
示例#2
0
        /// <summary> Return the query as JSON url, e.g. "Customer?{where:{FirstName:'Maria'}}" </summary>
        private string GetJsonResourcePath(string resourceName)
        {
            var json = JsonQueryExpressionVisitor.Translate(this.Expression, out string parameters);

            if (json.Length > 2)
            {
                // TODO may be able to get away with not escaping the URI
                System.Diagnostics.Debug.WriteLine($"json query: {json}");
                var uri = Uri.EscapeDataString(json);
                return(resourceName + '?' + uri + (parameters != null ? "&" + parameters : string.Empty));
            }
            else
            {
                return(resourceName);
            }
        }
        // TODO somehow compare JSON by structure instead of string, so whitespace changes won't matter
        private void Check(EntityQuery query, string expectedJson)
        {
            var json = JsonQueryExpressionVisitor.Translate(query.Expression, out string parameters);

            Assert.AreEqual(expectedJson, json);
        }