public virtual PostgresBinaryExpression MakePostgresBinary( PostgresExpressionType operatorType, [NotNull] SqlExpression left, [NotNull] SqlExpression right, [CanBeNull] RelationalTypeMapping typeMapping = null) { Check.NotNull(left, nameof(left)); Check.NotNull(right, nameof(right)); var returnType = left.Type; switch (operatorType) { case PostgresExpressionType.Contains: case PostgresExpressionType.ContainedBy: case PostgresExpressionType.Overlaps: case PostgresExpressionType.NetworkContainedByOrEqual: case PostgresExpressionType.NetworkContainsOrEqual: case PostgresExpressionType.NetworkContainsOrContainedBy: case PostgresExpressionType.RangeIsStrictlyLeftOf: case PostgresExpressionType.RangeIsStrictlyRightOf: case PostgresExpressionType.RangeDoesNotExtendRightOf: case PostgresExpressionType.RangeDoesNotExtendLeftOf: case PostgresExpressionType.RangeIsAdjacentTo: case PostgresExpressionType.TextSearchMatch: case PostgresExpressionType.JsonExists: case PostgresExpressionType.JsonExistsAny: case PostgresExpressionType.JsonExistsAll: returnType = typeof(bool); break; } return((PostgresBinaryExpression)ApplyTypeMapping( new PostgresBinaryExpression(operatorType, left, right, returnType, null), typeMapping)); }
/// <summary> /// Creates a new instance of the <see cref="PostgresBinaryExpression" /> class. /// </summary> /// <param name="operatorType">The operator to apply.</param> /// <param name="left">An expression which is left operand.</param> /// <param name="right">An expression which is right operand.</param> /// <param name="type">The <see cref="Type"/> of the expression.</param> /// <param name="typeMapping">The <see cref="RelationalTypeMapping"/> associated with the expression.</param> public PostgresBinaryExpression( PostgresExpressionType operatorType, SqlExpression left, SqlExpression right, Type type, RelationalTypeMapping?typeMapping) : base(type, typeMapping) { Check.NotNull(left, nameof(left)); Check.NotNull(right, nameof(right)); OperatorType = operatorType; Left = left; Right = right; }