コード例 #1
0
 /// <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
     }))
コード例 #2
0
 /// <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
     }))
コード例 #3
0
        /// <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;
        }
コード例 #4
0
 public virtual PostgresAnyExpression Any(
     [NotNull] SqlExpression item,
     [NotNull] SqlExpression array,
     PostgresAnyOperatorType operatorType)
 => (PostgresAnyExpression)ApplyDefaultTypeMapping(new PostgresAnyExpression(item, array, operatorType, null));