Exemple #1
0
        protected override SqlBuilder In(ListInitExpression expression, SqlBuilder sqlBuilder)
        {
            sqlBuilder.SqlInStr += "(";

            foreach (var expressionInit in expression.Initializers)
            {
                foreach (var expressionItem in expressionInit.Arguments)
                {
                    SqlProvider.In(expressionItem, sqlBuilder);
                }
            }

            if (sqlBuilder.SqlInStr.EndsWith(","))
            {
                sqlBuilder.SqlInStr = sqlBuilder.SqlInStr.Substring(0, sqlBuilder.SqlInStr.Length - 1);
            }

            sqlBuilder.SqlInStr += ")";

            //将SqlInStr追加到SqlWhereStr
            sqlBuilder.SqlWhereStr += sqlBuilder.SqlInStr;
            //清空SqlInStr
            sqlBuilder.SqlInStr = string.Empty;

            return(sqlBuilder);
        }
        protected override SqlBuilder In(NewArrayExpression expression, SqlBuilder sqlBuilder)
        {
            sqlBuilder.SqlInStr += "(";

            foreach (Expression expressionItem in expression.Expressions)
            {
                SqlProvider.In(expressionItem, sqlBuilder);
            }

            if (sqlBuilder.SqlInStr.EndsWith(","))
            {
                sqlBuilder.SqlInStr = sqlBuilder.SqlInStr.Substring(0, sqlBuilder.SqlInStr.Length - 1);
            }

            sqlBuilder.SqlInStr += ")";

            //将SqlInStr追加到SqlWhereStr
            sqlBuilder.SqlWhereStr += sqlBuilder.SqlInStr;
            //清空SqlInStr
            sqlBuilder.SqlInStr = string.Empty;

            return(sqlBuilder);
        }
 private static void InnerIn(MethodCallExpression expression, SqlBuilder sqlBuilder)
 {
     SqlProvider.Where(expression.Arguments[0], sqlBuilder);
     sqlBuilder.SqlWhereStr += " in";
     SqlProvider.In(expression.Arguments[1], sqlBuilder);
 }