Ejemplo n.º 1
0
        private static string Write(TextWriter writer, Expression expression, SqlType bizSql)
        {
            expression = PartialEvaluator.Eval(expression);
            ExpressionWriterSql bizR = new ExpressionWriterSql(writer)
            {
                _bizRead = bizSql
            };

            bizR.Visit(expression);

            string result;

            switch (bizSql)
            {
            case SqlType.Order:
                result = Regex.Replace(bizR._aiOrdeRsult, @",\s?$", "");
                return(result);

            case SqlType.Where:
                result = Regex.Replace(bizR._aiWhereResult, @"And\s?$", "");
                return(result);;

            default: return(string.Empty);
            }
        }
Ejemplo n.º 2
0
        private void SetOrderBy(Expression aiExp)
        {
            var itemstr = ExpressionWriterSql.BizWhereWriteToString(aiExp, SqlType.Order);

            if (string.IsNullOrWhiteSpace(_aiOrderByStr))
            {
                _aiOrderByStr = itemstr;
            }
            else
            {
                _aiOrderByStr = _aiOrderByStr + "," + itemstr;
            }
        }
Ejemplo n.º 3
0
        private void SetWhere(Expression aiExp, LambdaExpUnion bizUion = LambdaExpUnion.And)
        {
            var itemstr = ExpressionWriterSql.BizWhereWriteToString(aiExp, SqlType.Where);

            if (string.IsNullOrWhiteSpace(_aiWhereStr))
            {
                _aiWhereStr = itemstr;
            }
            else
            {
                if (bizUion == LambdaExpUnion.Or)
                {
                    _aiWhereStr = _aiWhereStr + " Or " + itemstr;
                }
                else
                {
                    _aiWhereStr = _aiWhereStr + " And " + itemstr;
                }
            }
        }