Beispiel #1
0
        /// <summary>
        ///  查询方法,条件查询Or操作
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <param name="query"></param>
        /// <param name="whereExpression">条件表达式</param>
        /// <returns>查询构造器,后面可接其它查询构造器方法</returns>
        public static SelectQuery <TModel> Or <TModel>(this SelectQuery <TModel> query, Expression <Func <TModel, bool> > whereExpression)
        {
            string whereSQL = TranslateExtendtion.TranslateConditional(whereExpression, query.Provider);
            Regex  regex    = new Regex(@"[a-z|A-Z]+\w*\.");

            whereSQL = regex.Replace(whereSQL, @"T1.");
            query.WhereCreater.Append(" OR ")
            .Append(whereSQL);
            return(query);
        }
Beispiel #2
0
        private QueryConditional AndOr(Expression expr, string andor)
        {
            string conditional = TranslateExtendtion.TranslateConditional(expr, DataProvider);

            this.strConditional
            .Append(" ")
            .Append(andor)
            .Append(" ")
            .Append(conditional);
            return(this);
        }