/// <summary> /// Constructs a <see cref="PostgresAnyExpression"/>. /// </summary> /// <param name="operatorType">The operator symbol to the array expression.</param> /// <param name="item">The value to find.</param> /// <param name="array">The array to search.</param> /// <param name="typeMapping">The type mapping for the expression.</param> public PostgresAnyExpression( SqlExpression item, SqlExpression array, PostgresAnyOperatorType operatorType, RelationalTypeMapping?typeMapping) : base(typeof(bool), typeMapping) { if (!(array is SqlConstantExpression { Value : null }))
/// <summary> /// Constructs a <see cref="PostgresAnyExpression"/>. /// </summary> /// <param name="operatorType">The operator symbol to the array expression.</param> /// <param name="item">The value to find.</param> /// <param name="array">The array to search.</param> /// <param name="typeMapping">The type mapping for the expression.</param> public PostgresAnyExpression( [NotNull] SqlExpression item, [NotNull] SqlExpression array, PostgresAnyOperatorType operatorType, [CanBeNull] RelationalTypeMapping typeMapping) : base(typeof(bool), typeMapping) { if (!(array is SqlConstantExpression { Value : null }))
/// <summary> /// Constructs a <see cref="PostgresAnyExpression"/>. /// </summary> /// <param name="operatorType">The operator symbol to the array expression.</param> /// <param name="item">The value to find.</param> /// <param name="array">The array to search.</param> /// <param name="typeMapping">The type mapping for the expression.</param> public PostgresAnyExpression( [NotNull] SqlExpression item, [NotNull] SqlExpression array, PostgresAnyOperatorType operatorType, [CanBeNull] RelationalTypeMapping typeMapping) : base(typeof(bool), typeMapping) { if (!array.Type.IsArrayOrGenericList()) { throw new ArgumentException("Array expression must be of type array or List<>", nameof(array)); } if (array is SqlConstantExpression && operatorType == PostgresAnyOperatorType.Equal) { throw new ArgumentException($"Use {nameof(InExpression)} for equality against constant arrays", nameof(array)); } Item = item; Array = array; OperatorType = operatorType; }
public virtual PostgresAnyExpression Any( [NotNull] SqlExpression item, [NotNull] SqlExpression array, PostgresAnyOperatorType operatorType) => (PostgresAnyExpression)ApplyDefaultTypeMapping(new PostgresAnyExpression(item, array, operatorType, null));