예제 #1
0
 protected override SqlGenerate Select(NewExpression expression, SqlGenerate sqlGenerate)
 {
     foreach (Expression item in expression.Arguments)
     {
         SqlExpressionProvider.Select(item, sqlGenerate);
     }
     return(sqlGenerate);
 }
예제 #2
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="orderBy">排序字段</param>
        /// <returns></returns>
        public SqlExpressionCore <T> Select(Expression <Func <T, object> > expression = null, string orderBy = "")
        {
            var sql    = $"select {{0}}{Environment.NewLine}from {sqlGenerate.TableName}";
            var fields = string.Empty;

            if (expression == null)
            {
                fields = "*";
            }
            else
            {
                SqlExpressionProvider.Select(expression, sqlGenerate);
                fields = sqlGenerate.SelectFieldsStr;
            }

            sqlGenerate.Sql.AppendFormat(sql, fields);
            return(this);
        }
예제 #3
0
 protected override SqlGenerate Select(UnaryExpression expression, SqlGenerate sqlGenerate)
 {
     SqlExpressionProvider.Select(expression.Operand, sqlGenerate);
     return(sqlGenerate);
 }
예제 #4
0
 protected override SqlGenerate Select(LambdaExpression expression, SqlGenerate sqlGenerate)
 {
     SqlExpressionProvider.Select(expression.Body, sqlGenerate);
     return(sqlGenerate);
 }