1. 程式人生 > >MVC中構建Linq條件、排序、Selector字段過濾

MVC中構建Linq條件、排序、Selector字段過濾

ssi mvc bsp 分別是 fun clas div lin con

代碼:

System.Linq.Expressions.Expression<Func<Domain.S_ROLE, bool>> expressWhere1 = (c => c.R_NAME.Contains(keywords));
System.Linq.Expressions.Expression
<Func<Domain.S_ROLE, int>> orderBy1 = c => c.R_ORDERID; Func<IQueryable<Domain.S_ROLE>, List<Domain.S_ROLE>> selector1 = (c=>c.Select(p => new
Domain.S_ROLE (){ R_ID = p.R_ID, R_NAME= p.R_NAME }).ToList<Domain.S_ROLE>());

分別是 條件、排序、字段過濾。

MVC中構建Linq條件、排序、Selector字段過濾