Table of Contents

Class PgFunctionExpression

Namespace
Npgsql.EntityFrameworkCore.PostgreSQL.Query.Expressions.Internal
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.dll

Represents a SQL function call expression, supporting PostgreSQL's named parameter notation (e.g. make_interval(weeks => 2) and non-comma parameter separators (e.g. position(substring in string)).

public class PgFunctionExpression : SqlFunctionExpression, IRelationalQuotableExpression, IPrintableExpression, IEquatable<PgFunctionExpression>
Inheritance
PgFunctionExpression
Implements
Inherited Members

Constructors

PgFunctionExpression(string, IEnumerable<SqlExpression>, IEnumerable<string?>?, IEnumerable<string?>?, bool, SqlExpression?, IReadOnlyList<OrderingExpression>, bool, IEnumerable<bool>, Type, RelationalTypeMapping?)

Creates a new instance of PgFunctionExpression.

public PgFunctionExpression(string name, IEnumerable<SqlExpression> arguments, IEnumerable<string?>? argumentNames, IEnumerable<string?>? argumentSeparators, bool aggregateDistinct, SqlExpression? aggregatePredicate, IReadOnlyList<OrderingExpression> aggregateOrderings, bool nullable, IEnumerable<bool> argumentsPropagateNullability, Type type, RelationalTypeMapping? typeMapping)

Parameters

name string
arguments IEnumerable<SqlExpression>
argumentNames IEnumerable<string>
argumentSeparators IEnumerable<string>
aggregateDistinct bool
aggregatePredicate SqlExpression
aggregateOrderings IReadOnlyList<OrderingExpression>
nullable bool
argumentsPropagateNullability IEnumerable<bool>
type Type
typeMapping RelationalTypeMapping

Properties

AggregateOrderings

For aggregate methods, contains the orderings to be applied.

public virtual IReadOnlyList<OrderingExpression> AggregateOrderings { get; }

Property Value

IReadOnlyList<OrderingExpression>

AggregatePredicate

For aggregate methods, contains the predicate to be applied (generated as the SQL FILTER clause).

public virtual SqlExpression? AggregatePredicate { get; }

Property Value

SqlExpression

ArgumentNames

List of argument names, corresponding position-wise to arguments in Arguments. Unnamed (positional) arguments must come first, so this list must contain possible nulls, followed by non-nulls.

public virtual IReadOnlyList<string?> ArgumentNames { get; }

Property Value

IReadOnlyList<string>

ArgumentSeparators

List of non-comma separators between argument separators, in the order in which they appear between the arguments. null as well as positions beyond the end of the list mean regular commas.

public virtual IReadOnlyList<string?> ArgumentSeparators { get; }

Property Value

IReadOnlyList<string>

Arguments

public virtual IReadOnlyList<SqlExpression> Arguments { get; }

Property Value

IReadOnlyList<SqlExpression>

ArgumentsPropagateNullability

public virtual IReadOnlyList<bool> ArgumentsPropagateNullability { get; }

Property Value

IReadOnlyList<bool>

IsAggregateDistinct

For aggregate methods, contains whether to apply distinct.

public virtual bool IsAggregateDistinct { get; }

Property Value

bool

Methods

ApplyTypeMapping(RelationalTypeMapping?)

Applies supplied type mapping to this expression.

public override SqlFunctionExpression ApplyTypeMapping(RelationalTypeMapping? typeMapping)

Parameters

typeMapping RelationalTypeMapping

A relational type mapping to apply.

Returns

SqlFunctionExpression

A new expression which has supplied type mapping.

CreateWithArgumentSeparators(string, IEnumerable<SqlExpression>, IEnumerable<string?>, bool, IEnumerable<bool>, bool, Type, RelationalTypeMapping?)

Creates an instance of PgFunctionExpression with argument separators.

public static PgFunctionExpression CreateWithArgumentSeparators(string name, IEnumerable<SqlExpression> arguments, IEnumerable<string?> argumentSeparators, bool nullable, IEnumerable<bool> argumentsPropagateNullability, bool builtIn, Type type, RelationalTypeMapping? typeMapping)

Parameters

name string
arguments IEnumerable<SqlExpression>
argumentSeparators IEnumerable<string>
nullable bool
argumentsPropagateNullability IEnumerable<bool>
builtIn bool
type Type
typeMapping RelationalTypeMapping

Returns

PgFunctionExpression

CreateWithNamedArguments(string, IEnumerable<SqlExpression>, IEnumerable<string?>, bool, IEnumerable<bool>, bool, Type, RelationalTypeMapping?)

Creates an instance of PgFunctionExpression with named arguments.

public static PgFunctionExpression CreateWithNamedArguments(string name, IEnumerable<SqlExpression> arguments, IEnumerable<string?> argumentNames, bool nullable, IEnumerable<bool> argumentsPropagateNullability, bool builtIn, Type type, RelationalTypeMapping? typeMapping)

Parameters

name string
arguments IEnumerable<SqlExpression>
argumentNames IEnumerable<string>
nullable bool
argumentsPropagateNullability IEnumerable<bool>
builtIn bool
type Type
typeMapping RelationalTypeMapping

Returns

PgFunctionExpression

Equals(PgFunctionExpression?)

Indicates whether the current object is equal to another object of the same type.

public virtual bool Equals(PgFunctionExpression? other)

Parameters

other PgFunctionExpression

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Print(ExpressionPrinter)

Creates a printable string representation of the given expression using ExpressionPrinter.

protected override void Print(ExpressionPrinter expressionPrinter)

Parameters

expressionPrinter ExpressionPrinter

The expression printer to use.

Update(SqlExpression?, IReadOnlyList<SqlExpression>?)

Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.

public override SqlFunctionExpression Update(SqlExpression? instance, IReadOnlyList<SqlExpression>? arguments)

Parameters

instance SqlExpression

The Instance property of the result.

arguments IReadOnlyList<SqlExpression>

The Arguments property of the result.

Returns

SqlFunctionExpression

This expression if no children changed, or an expression with the updated children.

UpdateAggregateComponents(SqlExpression?, IReadOnlyList<OrderingExpression>)

Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.

public virtual PgFunctionExpression UpdateAggregateComponents(SqlExpression? predicate, IReadOnlyList<OrderingExpression> orderings)

Parameters

predicate SqlExpression
orderings IReadOnlyList<OrderingExpression>

Returns

PgFunctionExpression

VisitChildren(ExpressionVisitor)

Reduces the node and then calls the visitor delegate on the reduced expression. The method throws an exception if the node is not reducible.

protected override Expression VisitChildren(ExpressionVisitor visitor)

Parameters

visitor ExpressionVisitor

An instance of Func<T, TResult>.

Returns

Expression

The expression being visited, or an expression which should replace it in the tree.