Exemple #1
0
        /// <summary>
        /// 前台类型获取
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="V"></typeparam>
        /// <param name="sourse"></param>
        /// <param name="selectAdd">优先赋值项目</param>
        /// <returns></returns>
        public static IQueryable <V> SelectTo <T, V>(this IQueryable <T> sourse, System.Linq.Expressions.Expression <Func <T, V> > selectAdd = null)
            where V : class, new()
            where T : class, new()
        {
            System.Linq.Expressions.Expression <Func <T, V> > select = SearchClass <T, T, V> .GetSelectLambda(selectAdd);

            return(sourse.Select(select));
        }
Exemple #2
0
        public static IQueryable <V> Search_Query <T, S, V>(this IQueryable <T> sourse, System.Linq.Expressions.Expression <Func <T, V> > selectAdd, S s1)
            where V : class, new()
            where S : class
            where T : class, new()
        {
            IQueryable <T> whereQuery = null;

            if (s1 != null)
            {
                System.Linq.Expressions.Expression <Func <T, bool> > where = SearchClass <T, S, V> .GetWhereLambda(s1);

                whereQuery = whereQuery.Where(where);
            }
            System.Linq.Expressions.Expression <Func <T, V> > select = SearchClass <T, S, V> .GetSelectLambda(selectAdd);

            return(sourse.Select(select));
        }