/// <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)); }
/// <summary> /// 查询条件 /// </summary> /// <typeparam name="T">数据源</typeparam> /// <typeparam name="S">查询实体</typeparam> /// <param name="sourse"></param> /// <param name="s1"></param> /// <returns></returns> public static IQueryable <T> WhereFrom <T, S>(this IQueryable <T> sourse, S s1, System.Linq.Expressions.Expression <Func <T, bool> > whereAdd = null) where T : class, new() where S : class { System.Linq.Expressions.Expression <Func <T, bool> > where = SearchClass <T, S, T> .GetWhereLambda(s1, whereAdd); return(sourse.Where(where)); }
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)); }