# Class NpgsqlSqlExpressionFactory

Namespace
  Npgsql.EntityFrameworkCore.PostgreSQL.Query

Assembly
  Npgsql.EntityFrameworkCore.PostgreSQL.dll

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

    public class NpgsqlSqlExpressionFactory : SqlExpressionFactory, ISqlExpressionFactory

Inheritance
  object
  SqlExpressionFactory
  NpgsqlSqlExpressionFactory

Implements
  ISqlExpressionFactory

Inherited Members
  SqlExpressionFactory.ApplyDefaultTypeMapping(SqlExpression)
  SqlExpressionFactory.Equal(SqlExpression, SqlExpression)
  SqlExpressionFactory.NotEqual(SqlExpression, SqlExpression)
  SqlExpressionFactory.GreaterThan(SqlExpression, SqlExpression)
  SqlExpressionFactory.GreaterThanOrEqual(SqlExpression, SqlExpression)
  SqlExpressionFactory.LessThan(SqlExpression, SqlExpression)
  SqlExpressionFactory.LessThanOrEqual(SqlExpression, SqlExpression)
  SqlExpressionFactory.AndAlso(SqlExpression, SqlExpression)
  SqlExpressionFactory.OrElse(SqlExpression, SqlExpression)
  SqlExpressionFactory.Add(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.Subtract(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.Multiply(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.Divide(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.Modulo(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.And(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.Or(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.Coalesce(SqlExpression, SqlExpression, RelationalTypeMapping)
  SqlExpressionFactory.MakeUnary(ExpressionType, SqlExpression, Type, RelationalTypeMapping, SqlExpression)
  SqlExpressionFactory.IsNull(SqlExpression)
  SqlExpressionFactory.IsNotNull(SqlExpression)
  SqlExpressionFactory.Convert(SqlExpression, Type, RelationalTypeMapping)
  SqlExpressionFactory.Not(SqlExpression)
  SqlExpressionFactory.Negate(SqlExpression)
  SqlExpressionFactory.Case(SqlExpression, IReadOnlyList<CaseWhenClause>, SqlExpression, SqlExpression)
  SqlExpressionFactory.Case(IReadOnlyList<CaseWhenClause>, SqlExpression)
  SqlExpressionFactory.Function(string, IEnumerable<SqlExpression>, bool, IEnumerable<bool>, Type, RelationalTypeMapping)
  SqlExpressionFactory.Function(string, string, IEnumerable<SqlExpression>, bool, IEnumerable<bool>, Type, RelationalTypeMapping)
  SqlExpressionFactory.Function(SqlExpression, string, IEnumerable<SqlExpression>, bool, bool, IEnumerable<bool>, Type, RelationalTypeMapping)
  SqlExpressionFactory.NiladicFunction(string, bool, Type, RelationalTypeMapping)
  SqlExpressionFactory.NiladicFunction(string, string, bool, Type, RelationalTypeMapping)
  SqlExpressionFactory.NiladicFunction(SqlExpression, string, bool, bool, Type, RelationalTypeMapping)
  SqlExpressionFactory.Exists(SelectExpression)
  SqlExpressionFactory.In(SqlExpression, SelectExpression)
  SqlExpressionFactory.In(SqlExpression, IReadOnlyList<SqlExpression>)
  SqlExpressionFactory.In(SqlExpression, SqlParameterExpression)
  SqlExpressionFactory.Like(SqlExpression, SqlExpression, SqlExpression)
  SqlExpressionFactory.Fragment(string, Type, RelationalTypeMapping)
  SqlExpressionFactory.Constant(object, RelationalTypeMapping)
  SqlExpressionFactory.Constant(object, Type, RelationalTypeMapping)
  SqlExpressionFactory.Constant(object, bool, RelationalTypeMapping)
  SqlExpressionFactory.Constant(object, Type, bool, RelationalTypeMapping)
  SqlExpressionFactory.Dependencies
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Constructors

### NpgsqlSqlExpressionFactory(SqlExpressionFactoryDependencies)

Creates a new instance of the NpgsqlSqlExpressionFactory class.

    public NpgsqlSqlExpressionFactory(SqlExpressionFactoryDependencies dependencies)

#### Parameters

`dependencies` SqlExpressionFactoryDependencies

  Parameter object containing dependencies for this class.

## Methods

### AggregateFunction(string, IEnumerable<SqlExpression>, EnumerableExpression, bool, IEnumerable<bool>, Type, RelationalTypeMapping?)

Creates a new PgFunctionExpression for a PostgreSQL aggregate function call..

    public virtual PgFunctionExpression AggregateFunction(string name, IEnumerable<SqlExpression> arguments, EnumerableExpression aggregateEnumerableExpression, bool nullable, IEnumerable<bool> argumentsPropagateNullability, Type returnType, RelationalTypeMapping? typeMapping = null)

#### Parameters

`name` string
`arguments` IEnumerable<SqlExpression>
`aggregateEnumerableExpression` EnumerableExpression
`nullable` bool
`argumentsPropagateNullability` IEnumerable<bool>
`returnType` Type
`typeMapping` RelationalTypeMapping

#### Returns

PgFunctionExpression

### All(SqlExpression, SqlExpression, PgAllOperatorType)

Creates a new PgAllExpression, corresponding to the PostgreSQL-specific `LIKE ALL` operator.

    public virtual PgAllExpression All(SqlExpression item, SqlExpression array, PgAllOperatorType operatorType)

#### Parameters

`item` SqlExpression
`array` SqlExpression
`operatorType` PgAllOperatorType

#### Returns

PgAllExpression

### Any(SqlExpression, SqlExpression, PgAnyOperatorType)

Creates a new PgAnyExpression, corresponding to the PostgreSQL-specific `= ANY` operator.

    public virtual PgAnyExpression Any(SqlExpression item, SqlExpression array, PgAnyOperatorType operatorType)

#### Parameters

`item` SqlExpression
`array` SqlExpression
`operatorType` PgAnyOperatorType

#### Returns

PgAnyExpression

### ApplyTypeMapping(SqlExpression?, RelationalTypeMapping?)

Applies type mapping to the given SqlExpression.

    public override SqlExpression? ApplyTypeMapping(SqlExpression? sqlExpression, RelationalTypeMapping? typeMapping)

#### Parameters

`sqlExpression` SqlExpression

  A SQL expression to apply type mapping.

`typeMapping` RelationalTypeMapping

  A type mapping to apply.

#### Returns

SqlExpression

  A SQL expression with given type mapping applied.

### ArrayIndex(SqlExpression, SqlExpression, bool, RelationalTypeMapping?)

Creates a new PgArrayIndexExpression, corresponding to the PostgreSQL-specific array subscripting operator.

    public virtual PgArrayIndexExpression ArrayIndex(SqlExpression array, SqlExpression index, bool nullable, RelationalTypeMapping? typeMapping = null)

#### Parameters

`array` SqlExpression
`index` SqlExpression
`nullable` bool
`typeMapping` RelationalTypeMapping

#### Returns

PgArrayIndexExpression

### ArraySlice(SqlExpression, SqlExpression?, SqlExpression?, bool, RelationalTypeMapping?)

Creates a new PgArrayIndexExpression, corresponding to the PostgreSQL-specific array subscripting operator.

    public virtual PgArraySliceExpression ArraySlice(SqlExpression array, SqlExpression? lowerBound, SqlExpression? upperBound, bool nullable, RelationalTypeMapping? typeMapping = null)

#### Parameters

`array` SqlExpression
`lowerBound` SqlExpression
`upperBound` SqlExpression
`nullable` bool
`typeMapping` RelationalTypeMapping

#### Returns

PgArraySliceExpression

### AtTimeZone(SqlExpression, SqlExpression, Type, RelationalTypeMapping?)

Creates a new AtTimeZoneExpression, for converting a timestamp to another time zone.

    public virtual AtTimeZoneExpression AtTimeZone(SqlExpression timestamp, SqlExpression timeZone, Type type, RelationalTypeMapping? typeMapping = null)

#### Parameters

`timestamp` SqlExpression
`timeZone` SqlExpression
`type` Type
`typeMapping` RelationalTypeMapping

#### Returns

AtTimeZoneExpression

### AtUtc(SqlExpression, RelationalTypeMapping?)

Creates a new AtTimeZoneExpression, for converting a timestamp to UTC.

    public virtual AtTimeZoneExpression AtUtc(SqlExpression timestamp, RelationalTypeMapping? typeMapping = null)

#### Parameters

`timestamp` SqlExpression
`typeMapping` RelationalTypeMapping

#### Returns

AtTimeZoneExpression

### ContainedBy(SqlExpression, SqlExpression)

Creates a new PgBinaryExpression, for checking whether one value is contained by another.

    public virtual SqlExpression ContainedBy(SqlExpression left, SqlExpression right)

#### Parameters

`left` SqlExpression
`right` SqlExpression

#### Returns

SqlExpression

### Contains(SqlExpression, SqlExpression)

Creates a new PgBinaryExpression, for checking whether one value contains another.

    public virtual SqlExpression Contains(SqlExpression left, SqlExpression right)

#### Parameters

`left` SqlExpression
`right` SqlExpression

#### Returns

SqlExpression

### GenerateOneBasedIndexExpression(SqlExpression)

PostgreSQL array indexing is 1-based. If the index happens to be a constant, just increment it. Otherwise, append a +1 in the SQL.

    public virtual SqlExpression GenerateOneBasedIndexExpression(SqlExpression expression)

#### Parameters

`expression` SqlExpression

#### Returns

SqlExpression

### ILike(SqlExpression, SqlExpression, SqlExpression?)

Creates a new AtTimeZoneExpression, for performing a PostgreSQL-specific case-insensitive string match (`ILIKE`).

    public virtual PgILikeExpression ILike(SqlExpression match, SqlExpression pattern, SqlExpression? escapeChar = null)

#### Parameters

`match` SqlExpression
`pattern` SqlExpression
`escapeChar` SqlExpression

#### Returns

PgILikeExpression

### JsonTraversal(SqlExpression, bool, Type, RelationalTypeMapping?)

Creates a new PgJsonTraversalExpression, for traversing inside a JSON document.

    public virtual PgJsonTraversalExpression JsonTraversal(SqlExpression expression, bool returnsText, Type type, RelationalTypeMapping? typeMapping = null)

#### Parameters

`expression` SqlExpression
`returnsText` bool
`type` Type
`typeMapping` RelationalTypeMapping

#### Returns

PgJsonTraversalExpression

### JsonTraversal(SqlExpression, IEnumerable<SqlExpression>, bool, Type, RelationalTypeMapping?)

Creates a new PgJsonTraversalExpression, for traversing inside a JSON document.

    public virtual PgJsonTraversalExpression JsonTraversal(SqlExpression expression, IEnumerable<SqlExpression> path, bool returnsText, Type type, RelationalTypeMapping? typeMapping = null)

#### Parameters

`expression` SqlExpression
`path` IEnumerable<SqlExpression>
`returnsText` bool
`type` Type
`typeMapping` RelationalTypeMapping

#### Returns

PgJsonTraversalExpression

### MakeBinary(ExpressionType, SqlExpression, SqlExpression, RelationalTypeMapping?, SqlExpression?)

Creates a new SqlExpression with the given arguments.

    public override SqlExpression? MakeBinary(ExpressionType operatorType, SqlExpression left, SqlExpression right, RelationalTypeMapping? typeMapping, SqlExpression? existingExpr = null)

#### Parameters

`operatorType` ExpressionType

  An ExpressionType representing SQL unary operator.

`left` SqlExpression

  The left operand of binary operation.

`right` SqlExpression

  The right operand of binary operation.

`typeMapping` RelationalTypeMapping

  A type mapping to be assigned to the created expression.

`existingExpr` SqlExpression

#### Returns

SqlExpression

  A SqlExpression with the given arguments.

### MakePostgresBinary(PgExpressionType, SqlExpression, SqlExpression, RelationalTypeMapping?)

Creates a new PgBinaryExpression with the given arguments.

    public virtual SqlExpression MakePostgresBinary(PgExpressionType operatorType, SqlExpression left, SqlExpression right, RelationalTypeMapping? typeMapping = null)

#### Parameters

`operatorType` PgExpressionType

  An ExpressionType representing SQL unary operator.

`left` SqlExpression

  The left operand of binary operation.

`right` SqlExpression

  The right operand of binary operation.

`typeMapping` RelationalTypeMapping

  A type mapping to be assigned to the created expression.

#### Returns

SqlExpression

  A PgBinaryExpression with the given arguments.

### NewArray(IReadOnlyList<SqlExpression>, Type, RelationalTypeMapping?)

Creates a new PgNewArrayExpression, for creating a new PostgreSQL array.

    public virtual PgNewArrayExpression NewArray(IReadOnlyList<SqlExpression> expressions, Type type, RelationalTypeMapping? typeMapping = null)

#### Parameters

`expressions` IReadOnlyList<SqlExpression>
`type` Type
`typeMapping` RelationalTypeMapping

#### Returns

PgNewArrayExpression

### NewArrayOrConstant(IReadOnlyList<SqlExpression>, Type, RelationalTypeMapping?)

Constructs either a PgNewArrayExpression, or, if all provided expressions are constants, a single SqlConstantExpression for the entire array.

    public virtual SqlExpression NewArrayOrConstant(IReadOnlyList<SqlExpression> elements, Type type, RelationalTypeMapping? typeMapping = null)

#### Parameters

`elements` IReadOnlyList<SqlExpression>
`type` Type
`typeMapping` RelationalTypeMapping

#### Returns

SqlExpression

### Overlaps(SqlExpression, SqlExpression)

Creates a new PgBinaryExpression, for checking whether one value overlaps with another.

    public virtual SqlExpression Overlaps(SqlExpression left, SqlExpression right)

#### Parameters

`left` SqlExpression
`right` SqlExpression

#### Returns

SqlExpression

### RegexMatch(SqlExpression, SqlExpression, RegexOptions)

Creates a new PgRegexMatchExpression, corresponding to the PostgreSQL-specific `~` operator.

    public virtual PgRegexMatchExpression RegexMatch(SqlExpression match, SqlExpression pattern, RegexOptions options)

#### Parameters

`match` SqlExpression
`pattern` SqlExpression
`options` RegexOptions

#### Returns

PgRegexMatchExpression