Пример #1
0
        public static Expression InPrimaryKey(Expression element, PrimaryKey[] values)
        {
            var cleanValues = values.Select(a => a.Object).ToArray();

            var cleanElement = SmartEqualizer.UnwrapPrimaryKey(element);

            if (cleanElement == NewId)
            {
                return(False);
            }

            return(InExpression.FromValues(DbExpressionNominator.FullNominate(cleanElement), cleanValues));
        }
Пример #2
0
        protected internal virtual Expression VisitIn(InExpression @in)
        {
            var expression = this.Visit(@in.Expression);
            var select     = (SelectExpression)this.Visit(@in.Select);

            if (expression != @in.Expression || select != @in.Select)
            {
                if (select != null)
                {
                    return(new InExpression(expression, select));
                }
                else
                {
                    return(InExpression.FromValues(expression, @in.Values !));
                }
            }
            return(@in);
        }
Пример #3
0
        public static Expression In(Expression element, object[] values)
        {
            var nominate = DbExpressionNominator.FullNominate(element) !;

            if (nominate is ToDayOfWeekExpression dowe)
            {
                byte dateFirs    = ToDayOfWeekExpression.DateFirst.Value.Item1;
                var  sqlWeekDays = values.Cast <DayOfWeek>()
                                   .Select(a => (object)ToDayOfWeekExpression.ToSqlWeekDay(a, dateFirs))
                                   .ToArray();

                return(InExpression.FromValues(dowe.Expression, sqlWeekDays));
            }
            else
            {
                return(InExpression.FromValues(nominate, values));
            }
        }
Пример #4
0
        public static Expression InPrimaryKey(Expression element, PrimaryKey[] values)
        {
            var cleanValues = values.Select(a => a.Object).ToArray();

            var cleanElement = SmartEqualizer.UnwrapPrimaryKey(element);

            if (cleanElement == NewId)
            {
                return(False);
            }

            cleanElement = DbExpressionNominator.FullNominate(cleanElement) !;

            if (cleanElement.Type == typeof(string))
            {
                return(InExpression.FromValues(cleanElement, cleanValues.Select(a => (object)a.ToString() !).ToArray()));
            }
            else
            {
                return(InExpression.FromValues(cleanElement, cleanValues));
            }
        }
Пример #5
0
 public static Expression In(Expression element, object[] values)
 {
     return(InExpression.FromValues(DbExpressionNominator.FullNominate(element), values));
 }
Пример #6
0
 protected virtual bool CompareIn(InExpression a, InExpression b)
 {
     return(Compare(a.Expression, b.Expression) &&
            Compare(a.Select, b.Select) &&
            CompareValues(a.Values, b.Values));
 }
 // don't count aggregates in subqueries
 protected internal override Expression VisitIn(InExpression @in)
 {
     return(base.VisitIn(@in));
 }