/// <inheritdoc />
    protected override void Print(ExpressionPrinter expressionPrinter)
    {
        if (!string.IsNullOrEmpty(Schema))
        {
            expressionPrinter.Append(Schema).Append(".").Append(Name);
        }
        else
        {
            Check.DebugAssert(Instance is null, "Instance is null");

            expressionPrinter.Append(Name);
        }

        if (!IsNiladic)
        {
            expressionPrinter.Append("(");

            if (IsAggregateDistinct)
            {
                expressionPrinter.Append("DISTINCT ");
            }

            expressionPrinter.VisitCollection(Arguments);

            if (AggregateOrderings.Count > 0)
            {
                expressionPrinter.Append(" ORDER BY ");
                expressionPrinter.VisitCollection(AggregateOrderings);
            }

            expressionPrinter.Append(")");

            if (AggregatePredicate is not null)
            {
                expressionPrinter.Append(" FILTER (WHERE ");
                expressionPrinter.Visit(AggregatePredicate);
                expressionPrinter.Append(")");
            }
        }
    }
        protected override void Print(ExpressionPrinter expressionPrinter)
        {
            Check.NotNull(expressionPrinter, nameof(expressionPrinter));

            if (OperatorType == ExpressionType.Convert &&
                TypeMapping != null)
            {
                expressionPrinter.Append("CAST(");
                expressionPrinter.Visit(Operand);
                expressionPrinter.Append(")");
                expressionPrinter.Append(" AS ");
                expressionPrinter.Append(TypeMapping.StoreType);
                expressionPrinter.Append(")");
            }
            else
            {
                expressionPrinter.Append(OperatorType.ToString());
                expressionPrinter.Append("(");
                expressionPrinter.Visit(Operand);
                expressionPrinter.Append(")");
            }
        }
Exemplo n.º 3
0
    private void Print(
        object?value,
        ExpressionPrinter expressionPrinter)
    {
        if (value is IEnumerable enumerable &&
            !(value is string) &&
            !(value is byte[]))
        {
            var first = true;
            foreach (var item in enumerable)
            {
                if (!first)
                {
                    expressionPrinter.Append(", ");
                }

                first = false;
                Print(item, expressionPrinter);
            }
        }
        protected override void Print(ExpressionPrinter expressionPrinter)
        {
            var requiresBrackets = RequiresBrackets(Left);

            if (requiresBrackets)
            {
                expressionPrinter.Append("(");
            }

            expressionPrinter.Visit(Left);

            if (requiresBrackets)
            {
                expressionPrinter.Append(")");
            }

            switch (OperatorType)
            {
            case MySqlBinaryExpressionOperatorType.IntegerDivision:
                expressionPrinter.Append(" DIV ");
                break;

            case MySqlBinaryExpressionOperatorType.NonOptimizedEqual:
                expressionPrinter.Append(" = ");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            requiresBrackets = RequiresBrackets(Right);

            if (requiresBrackets)
            {
                expressionPrinter.Append("(");
            }

            expressionPrinter.Visit(Right);

            if (requiresBrackets)
            {
                expressionPrinter.Append(")");
            }
        }
Exemplo n.º 5
0
        public virtual void Print(ExpressionPrinter expressionPrinter)
        {
            expressionPrinter.AppendLine(nameof(InMemoryQueryExpression) + ": ");
            using (expressionPrinter.Indent())
            {
                expressionPrinter.AppendLine(nameof(ServerQueryExpression) + ": ");
                using (expressionPrinter.Indent())
                {
                    expressionPrinter.Visit(ServerQueryExpression);
                }

                expressionPrinter.AppendLine("ProjectionMapping:");
                using (expressionPrinter.Indent())
                {
                    foreach (var projectionMapping in _projectionMapping)
                    {
                        expressionPrinter.Append("Member: " + projectionMapping.Key + " Projection: ");
                        expressionPrinter.Visit(projectionMapping.Value);
                    }
                }

                expressionPrinter.AppendLine();
            }
        }
Exemplo n.º 6
0
        protected override void Print(ExpressionPrinter expressionPrinter)
        {
            expressionPrinter.Append("MATCH ");
            expressionPrinter.Append($"({expressionPrinter.Visit(Match)})");
            expressionPrinter.Append(" AGAINST ");
            expressionPrinter.Append($"({expressionPrinter.Visit(Against)}");

            switch (SearchMode)
            {
            case MySqlMatchSearchMode.NaturalLanguage:
                break;

            case MySqlMatchSearchMode.NaturalLanguageWithQueryExpansion:
                expressionPrinter.Append(" WITH QUERY EXPANSION");
                break;

            case MySqlMatchSearchMode.Boolean:
                expressionPrinter.Append(" IN BOOLEAN MODE");
                break;
            }

            expressionPrinter.Append(")");
        }
        void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
        {
            Check.NotNull(expressionPrinter, nameof(expressionPrinter));

            expressionPrinter.Append(ToString());
        }
Exemplo n.º 8
0
 /// <inheritdoc />
 protected override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Append("CROSS APPLY ");
     expressionPrinter.Visit(Table);
 }
Exemplo n.º 9
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public virtual void Print(ExpressionPrinter expressionPrinter)
        {
            Check.NotNull(expressionPrinter, nameof(expressionPrinter));

            expressionPrinter.Append(ToString());
        }
Exemplo n.º 10
0
 protected override void Print(ExpressionPrinter expressionPrinter)
 => expressionPrinter.Append("FakeSqlExpression");
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public override void Print(ExpressionPrinter expressionPrinter)
 => expressionPrinter.Append(ToString());
Exemplo n.º 12
0
        protected override void Print(ExpressionPrinter expressionPrinter)
        {
            Check.NotNull(expressionPrinter, nameof(expressionPrinter));

            expressionPrinter.Append("@" + _parameterExpression.Name);
        }
Exemplo n.º 13
0
 public override void Print(ExpressionPrinter expressionPrinter)
 => expressionPrinter.Append("@" + _parameterExpression.Name);
Exemplo n.º 14
0
    /// <inheritdoc />
    void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
    {
        expressionPrinter.Visit(Expression);

        expressionPrinter.Append(IsAscending ? " ASC" : " DESC");
    }
Exemplo n.º 15
0
        protected override void Print(ExpressionPrinter expressionPrinter)
        {
            expressionPrinter.ThrowIfNull(nameof(expressionPrinter));

            expressionPrinter.Append(Name).Append(" AS ").Append(Alias);
        }
Exemplo n.º 16
0
 /// <inheritdoc />
 protected override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Append(TableAlias).Append(".");
     expressionPrinter.Append(Name);
 }
Exemplo n.º 17
0
 /// <inheritdoc />
 protected override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Append("OUTER APPLY ");
     expressionPrinter.Visit(Table);
     PrintAnnotations(expressionPrinter);
 }
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public virtual void Print(ExpressionPrinter expressionPrinter)
        {
            expressionPrinter.Visit(Expression);

            expressionPrinter.Append(IsAscending ? " ASC" : " DESC");
        }
        void IPrintableExpression.Print(ExpressionPrinter expressionPrinter)
        {
            Check.NotNull(expressionPrinter, nameof(expressionPrinter));

            expressionPrinter.Append(nameof(InMemoryTableExpression) + ": Entity: " + EntityType.DisplayName());
        }
Exemplo n.º 20
0
 protected override void Print(ExpressionPrinter expressionPrinter)
 => expressionPrinter.Append(ToString());
 private void Print(object value, ExpressionPrinter expressionPrinter)
 => expressionPrinter.Append(TypeMapping?.GenerateSqlLiteral(value) ?? Value?.ToString() ?? "NULL");
Exemplo n.º 22
0
 public virtual void Print(ExpressionPrinter expressionPrinter) => expressionPrinter.Append(ToString());
 public override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Append(ToString()); // TODO: ist this correct?
 }
Exemplo n.º 24
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 protected override void Print(ExpressionPrinter expressionPrinter)
 {
     base.Print(expressionPrinter);
     expressionPrinter.Append($".TemporalContainedIn({From}, {To})");
 }
Exemplo n.º 25
0
        /// <inheritdoc />
        protected override void Print(ExpressionPrinter expressionPrinter)
        {
            Check.NotNull(expressionPrinter, nameof(expressionPrinter));

            expressionPrinter.Append(Sql);
        }
 public override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Visit(Left);
     expressionPrinter.Append(Operator);
     expressionPrinter.Visit(Right);
 }
Exemplo n.º 27
0
 public override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Visit(LambdaParameter);
     expressionPrinter.Append(" -> ");
     expressionPrinter.Visit(Inner);
 }
Exemplo n.º 28
0
 public override void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Append(this.Function);
     expressionPrinter.VisitList(this.Arguments);
 }
Exemplo n.º 29
0
 public virtual void Print(ExpressionPrinter expressionPrinter)
 {
     expressionPrinter.Append(nameof(HarmonyTableExpression) + ": Entity: " + EntityType.DisplayName());
 }
Exemplo n.º 30
0
    /// <inheritdoc />
    protected override void Print(ExpressionPrinter expressionPrinter)
    {
        Check.NotNull(expressionPrinter, nameof(expressionPrinter));

        var requiresBrackets = RequiresBrackets(Left);

        if (requiresBrackets)
        {
            expressionPrinter.Append("(");
        }

        expressionPrinter.Visit(Left);

        if (requiresBrackets)
        {
            expressionPrinter.Append(")");
        }

        expressionPrinter
        .Append(" ")
        .Append(OperatorType switch
        {
            PostgresExpressionType.Contains => "@>",
            PostgresExpressionType.ContainedBy => "<@",
            PostgresExpressionType.Overlaps => "&&",

            PostgresExpressionType.NetworkContainedByOrEqual => "<<=",
            PostgresExpressionType.NetworkContainsOrEqual => ">>=",
            PostgresExpressionType.NetworkContainsOrContainedBy => "&&",

            PostgresExpressionType.RangeIsStrictlyLeftOf => "<<",
            PostgresExpressionType.RangeIsStrictlyRightOf => ">>",
            PostgresExpressionType.RangeDoesNotExtendRightOf => "&<",
            PostgresExpressionType.RangeDoesNotExtendLeftOf => "&>",
            PostgresExpressionType.RangeIsAdjacentTo => "-|-",
            PostgresExpressionType.RangeUnion => "+",
            PostgresExpressionType.RangeIntersect => "*",
            PostgresExpressionType.RangeExcept => "-",

            PostgresExpressionType.TextSearchMatch => "@@",
            PostgresExpressionType.TextSearchAnd => "&&",
            PostgresExpressionType.TextSearchOr => "||",

            PostgresExpressionType.JsonExists => "?",
            PostgresExpressionType.JsonExistsAny => "?|",
            PostgresExpressionType.JsonExistsAll => "?&",

            PostgresExpressionType.LTreeMatches
            when Right.TypeMapping?.StoreType == "lquery" ||
            Right.TypeMapping is NpgsqlArrayTypeMapping arrayMapping &&
            arrayMapping.ElementMapping.StoreType == "lquery"
            => "~",
            PostgresExpressionType.LTreeMatches
            when Right.TypeMapping?.StoreType == "ltxtquery"
            => "@",
            PostgresExpressionType.LTreeMatchesAny => "?",
            PostgresExpressionType.LTreeFirstAncestor => "?@>",
            PostgresExpressionType.LTreeFirstDescendent => "?<@",
            PostgresExpressionType.LTreeFirstMatches
            when Right.TypeMapping?.StoreType == "lquery" => "?~",
            PostgresExpressionType.LTreeFirstMatches
            when Right.TypeMapping?.StoreType == "ltxtquery" => "?@",

            PostgresExpressionType.PostgisDistanceKnn => "<->",

            _ => throw new ArgumentOutOfRangeException($"Unhandled operator type: {OperatorType}")
        })