Пример #1
0
        private static string SysExpression_Analyize <T>(SysLE.Expression <Func <T, bool> > exp)
        {
            StringBuilder builder = new StringBuilder();

            SysExpressionWhere_Analyize(exp.Body, builder);
            return(builder.ToString());
        }
Пример #2
0
        public static Where <T> Where <T>(this From <T> from, SysLE.Expression <Func <T, bool> > expression) where T : class
        {
            Where <T> where = new Where <T>(default(T));
            where.SqlString = from.SqlString + where.ToString() + SysExpression_Analyize(expression);

            return(where);
        }
        public static OrderBy OrderBy <T, TSource>(this From from, SysLE.Expression <Func <T, TSource> > exp)
        {
            OrderBy orderby = new OrderBy(SysExpression_Analyize <T, TSource>(exp));

            orderby.SqlString = from.SqlString + orderby.ToString();

            return(orderby);
        }
 private static string SysExpression_Analyize <T, TSource>(SysLE.Expression <Func <T, TSource> > exp)
 {
     if (exp.Body.NodeType == SysLE.ExpressionType.Parameter)
     {
         return(exp.Name);
     }
     else if (exp.Body.NodeType == SysLE.ExpressionType.MemberAccess)
     {
         SysLE.MemberExpression mexp = (SysLE.MemberExpression)exp.Body;
         if (mexp == null)
         {
             return(string.Empty);
         }
         else
         {
             return(mexp.Member.Name);
         }
     }
     else
     {
         return(string.Empty);
     }
 }