我像这样从数据库中获取数据。
Dim query = From t1 In TBL1 _ Join t2 In TBL2 On t1.ID Equals t2.ID _ Join t3 In TBL3 On t1.ID Equals t3.ID _ Group Join t4 In t1 _ On t1.ID Equals t4.ID _ Into t4_Grp = Group _ Select t1, t2, t3, t4_Grp
当用户执行搜索时,我可以像这样过滤查询结果。
query = query.Where(Function(o) o.t1.ID = lngID)
上面一切正常。直到我想 lambda t4_Grp。我不知道如何在 t4_Grp 上做一个 lambda 表达式?
EZ
问问题
3604 次
1 回答
0
我过去用它来做一些权力分组。
private void ProducePivotAnalytic <T, K>(IEnumerable<T> colletion, Func<T, K> pivot)
{
var grouped =
from n in colletion
group n by pivot(n) into g
select new { theKey = g.Key, theValue = g };
// do some stuff with your grouped collection.
}
ProducePivotAnalytic<List<DateTime>, DayOfWeek>(
myDates,
(x) => (x.DayOfWeek) );
于 2011-08-25T15:59:37.233 回答