Beispiel #1
0
        private static SqlQuerySpec HandleMethodCallExpression(
            MethodCallExpression expression,
            IDictionary <object, string> parameters,
            CosmosSerializationOptions serializationOptions = null)
        {
            if (DocumentQueryEvaluator.IsTransformExpression(expression))
            {
                if (string.Compare(expression.Method.Name, DocumentQueryEvaluator.SQLMethod, StringComparison.Ordinal) == 0)
                {
                    return(DocumentQueryEvaluator.HandleAsSqlTransformExpression(expression));
                }
                else
                {
                    throw new DocumentQueryException(
                              string.Format(CultureInfo.CurrentUICulture,
                                            ClientResources.BadQuery_InvalidExpression,
                                            expression.ToString()));
                }
            }

            return(SqlTranslator.TranslateQuery(expression, serializationOptions, parameters));
        }
 private void DoTranslate <R>(Expression <Func <BenchmarkDocument, R> > expression)
 {
     SqlTranslator.TranslateExpression(expression.Body);
 }