Наследование: SqlFragment
Пример #1
0
 public OrderByDesc OrderByDesc(Expression expression, params Expression[] exprs)
 {
     if (expression == null) {
         throw new ArgumentNullException("expression");
     }
     return this.OrderByDesc(Collection<Expression>.From(expression, exprs));
 }
 protected UnaryPredicateOperator(Expression operand)
 {
     if (operand == null) {
         throw new ArgumentNullException("operand");
     }
     this.Operand = operand;
 }
Пример #3
0
        public SimpleCase(Expression expression)
        {
            if (expression == null) {
                throw new ArgumentNullException("expression");
            }

            this.Expression = expression;
        }
Пример #4
0
        public static Function Count(Expression exp)
        {
            if (exp == null) {
                throw new ArgumentNullException("exp");
            }

            return new SimpleFunction("COUNT", exp);
        }
Пример #5
0
        public AsExpression(Expression expression, string alias)
        {
            if (StringHelper.IsNullOrWhiteSpace(alias)) {
                throw new ArgumentOutOfRangeException("alias", "alias must be a valid sql alias name");
            }

            this.Expression1 = expression;
            this.Alias = alias;
        }
Пример #6
0
 public SimpleFunction(string functionName, Expression argument)
     : this(functionName, new[] { argument })
 {
     if (functionName == null) {
         throw new ArgumentNullException("functionName");
     }
     if (argument == null) {
         throw new ArgumentNullException("argument");
     }
 }
 public DivideArithmeticExpressionOperator(Expression leftOperand, Expression rightOperand)
     : base(leftOperand, rightOperand)
 {
     if (leftOperand == null) {
         throw new ArgumentNullException("leftOperand");
     }
     if (rightOperand == null) {
         throw new ArgumentNullException("rightOperand");
     }
 }
Пример #8
0
        public SimpleCase Else(Expression resultExpression)
        {
            if (resultExpression == null) {
                throw new ArgumentNullException("resultExpression");
            }

            this.ElseResultExpression = resultExpression;

            return this;
        }
Пример #9
0
 internal ExpressionAssign(Column column, Expression expression)
     : base(column, expression)
 {
     if (column == null) {
         throw new ArgumentNullException("column");
     }
     if (expression == null) {
         throw new ArgumentNullException("expression");
     }
 }
Пример #10
0
 public StartsWithPredicate(Expression exprLeft, Expression exprRight)
     : base(exprLeft, exprRight)
 {
     if (exprLeft == null) {
         throw new ArgumentNullException("exprLeft");
     }
     if (exprRight == null) {
         throw new ArgumentNullException("exprRight");
     }
 }
Пример #11
0
 public SearchedCaseCondition(Predicate whenPredicate, Expression thenValue)
 {
     if (whenPredicate == null) {
         throw new ArgumentNullException("whenPredicate");
     }
     if (thenValue == null) {
         throw new ArgumentNullException("thenValue");
     }
     this.WhenPredicate = whenPredicate;
     this.ThenValue = thenValue;
 }
 protected BinaryPredicateOperator(Expression leftOperand, Expression rightOperand)
 {
     if (leftOperand == null) {
         throw new ArgumentNullException("leftOperand");
     }
     if (rightOperand == null) {
         throw new ArgumentNullException("rightOperand");
     }
     this.LeftOperand = leftOperand;
     this.RightOperand = rightOperand;
 }
Пример #13
0
        public static Function Cast(Expression exp, SqlDataType type)
        {
            if (exp == null) {
                throw new ArgumentNullException("exp");
            }
            if (type == null) {
                throw new ArgumentNullException("type");
            }

            return new CastFunction(exp, type);
        }
Пример #14
0
 public InsertTopIntoTable(
     InsertStatement statement,
     Expression top,
     Table table,
     IEnumerable<Column> columnList)
     : base(statement)
 {
     this.Top = top;
     this.Table = table;
     this.ColumnList = columnList;
 }
Пример #15
0
 public CastFunction(Expression exp, SqlDataType type)
 {
     if (exp == null) {
         throw new ArgumentNullException("exp");
     }
     if (type == null) {
         throw new ArgumentNullException("type");
     }
     this.Expression = exp;
     this.Type = type;
 }
Пример #16
0
        public static Function DateAdd(DatePartType datePart, Expression number, Expression date)
        {
            if (number == null) {
                throw new ArgumentNullException("number");
            }

            if (date == null) {
                throw new ArgumentNullException("date");
            }

            return new DateAddFunction(datePart, number, date);
        }
Пример #17
0
 public UpdateTopPercentTable(UpdateStatement statement, Expression topPercent, Table table)
     : base(statement)
 {
     if (statement == null) {
         throw new ArgumentNullException("statement");
     }
     if (table == null) {
         throw new ArgumentNullException("table");
     }
     this.TopPercent = topPercent;
     this.Table = table;
 }
Пример #18
0
        public static Function Convert(SqlDataType type, Expression exp, uint? style = null)
        {
            if (type == null) {
                throw new ArgumentNullException("type");
            }

            if (exp == null) {
                throw new ArgumentNullException("exp");
            }

            return new ConvertFunction(type, exp, style);
        }
Пример #19
0
        public SearchedCase CaseWhen(Predicate whenPredicate, Expression thenValue)
        {
            if (whenPredicate == null) {
                throw new ArgumentNullException("whenPredicate");
            }

            if (thenValue == null) {
                throw new ArgumentNullException("thenValue");
            }

            this.conditions.Add(new SearchedCaseCondition(whenPredicate, thenValue));
            return this;
        }
Пример #20
0
        public SimpleCase When(Expression whenExpression, Expression resultExpression)
        {
            if (whenExpression == null) {
                throw new ArgumentNullException("whenExpression");
            }

            if (resultExpression == null) {
                throw new ArgumentNullException("resultExpression");
            }

            this.conditions.Add(new SimpleCaseCondition(whenExpression, resultExpression));
            return this;
        }
Пример #21
0
        protected Assignment(Column column, Expression expression)
        {
            if (column == null) {
                throw new ArgumentNullException("column");
            }

            if (expression == null) {
                string message = string.Format(
                    "Cannot set null expression on table [{0}], column [{1}]",
                    column.Table.TableName,
                    column.ColumnName);

                throw new SharpQLNullValueAssignmentException(message);
            }

            this.Column = column;
            this.Expression = expression;
        }
 public InsertTopPercentIntoTable(
     InsertStatement statement,
     Expression percent,
     Table table,
     IEnumerable<Column> columnList)
     : base(statement)
 {
     if (statement == null) {
         throw new ArgumentNullException("statement");
     }
     if (percent == null) {
         throw new ArgumentNullException("percent");
     }
     if (table == null) {
         throw new ArgumentNullException("table");
     }
     if (columnList == null) {
         throw new ArgumentNullException("columnList");
     }
     this.Percent = percent;
     this.Table = table;
     this.ColumnList = columnList;
 }
Пример #23
0
        public static Function Substring(Expression exp, Expression start, Expression lenght)
        {
            if (exp == null) {
                throw new ArgumentNullException("exp");
            }

            if (start == null) {
                throw new ArgumentNullException("start");
            }

            if (lenght == null) {
                throw new ArgumentNullException("lenght");
            }

            return new SimpleFunction("SUBSTRING", exp, start, lenght);
        }
Пример #24
0
        public static Function Right(Expression exp, uint lenght)
        {
            if (exp == null) {
                throw new ArgumentNullException("exp");
            }

            return new SimpleFunction("RIGHT", exp, lenght);
        }
Пример #25
0
        public static Function IsNull(Expression arg1, Expression arg2)
        {
            if (arg1 == null) {
                throw new ArgumentNullException("arg1");
            }

            if (arg2 == null) {
                throw new ArgumentNullException("arg2");
            }

            return new SimpleFunction("ISNULL", arg1, arg2);
        }
Пример #26
0
        public static bool TryGetConstant(object value, out Expression expression)
        {
            if (value == null) {
                throw new ArgumentNullException("value");
            }

            if (value is int) {
                expression = (int)value;
                return true;
            }
            if (value is uint) {
                expression = (uint)value;
                return true;
            }
            if (value is string) {
                expression = (string)value;
                return true;
            }
            if (value is DateTime) {
                expression = (DateTime)value;
                return true;
            }
            if (value is Guid) {
                expression = (Guid)value;
                return true;
            }
            if (value is long) {
                expression = (long)value;
                return true;
            }
            if (value is ulong) {
                expression = (ulong)value;
                return true;
            }
            if (value is short) {
                expression = (short)value;
                return true;
            }
            if (value is ushort) {
                expression = (ushort)value;
                return true;
            }
            if (value is byte) {
                expression = (byte)value;
                return true;
            }
            if (value is sbyte) {
                expression = (sbyte)value;
                return true;
            }
            if (value is float) {
                expression = (float)value;
                return true;
            }
            if (value is double) {
                expression = (double)value;
                return true;
            }
            if (value is decimal) {
                expression = (decimal)value;
                return true;
            }
            if (value is bool) {
                expression = (bool)value;
                return true;
            }
            if (value is char) {
                expression = (char)value;
                return true;
            }
            if (value is DateTimeOffset) {
                expression = (DateTimeOffset)value;
                return true;
            }
            if (value is byte[]) {
                expression = (byte[])value;
                return true;
            }

            if (value is XNode) {
                expression = (XNode)value;
                return true;
            }

            expression = null;
            return false;
        }