Example #1
0
        protected override SqlPack OrderBy(NewExpression expression, SqlPack sqlPack)
        {
            foreach (var item in expression.Arguments)
            {
                Expression2SqlProvider.OrderBy(item, sqlPack);
            }

            return(sqlPack);
        }
        private static void LikeLeft(MethodCallExpression expression, SqlPack sqlPack)
        {
            if (expression.Object != null)
            {
                Expression2SqlProvider.Where(expression.Object, sqlPack);
            }

            Expression2SqlProvider.Where(expression.Arguments[0], sqlPack);
            sqlPack += " like '%' +";
            Expression2SqlProvider.Where(expression.Arguments[1], sqlPack);
        }
Example #3
0
        protected override SqlPack In(NewArrayExpression expression, SqlPack sqlPack)
        {
            sqlPack += "(";

            foreach (var expressionItem in expression.Expressions)
            {
                Expression2SqlProvider.In(expressionItem, sqlPack);
            }

            if (sqlPack.Sql[sqlPack.Sql.Length - 1] == ',')
            {
                sqlPack.Sql.Remove(sqlPack.Sql.Length - 1, 1);
            }

            sqlPack += ")";

            return(sqlPack);
        }
        protected override SqlPack Where(BinaryExpression expression, SqlPack sqlPack)
        {
            Expression2SqlProvider.Where(expression.Left, sqlPack);
            var signIndex = sqlPack.Length;

            Expression2SqlProvider.Where(expression.Right, sqlPack);
            var sqlLength = sqlPack.Length;

            if (sqlLength - signIndex == 5 && sqlPack.ToString().EndsWith("null"))
            {
                OperatorParser(expression.NodeType, signIndex, sqlPack, true);
            }
            else
            {
                OperatorParser(expression.NodeType, signIndex, sqlPack);
            }

            return(sqlPack);
        }
 protected override SqlPack Sum(UnaryExpression expression, SqlPack sqlPack)
 {
     Expression2SqlProvider.Sum(expression.Operand, sqlPack);
     return(sqlPack);
 }
 private new static void In(MethodCallExpression expression, SqlPack sqlPack)
 {
     Expression2SqlProvider.Where(expression.Arguments[0], sqlPack);
     sqlPack += " in";
     Expression2SqlProvider.In(expression.Arguments[1], sqlPack);
 }