System.InvalidOperationException:“Client side GroupBy is not supported.”
客户端不支持GroupBy语句。
事故现场:
var q1 = Team1.GroupBy(x => x.T1 + x.T2 + x.T3 + x.T4 + x.T5, x => x.T1 +","+ x.T2 +","+ x.T3 +","+ x.T4 +","+ x.T5).OrderByDescending(x=>x.Count());
var q2 = Team1.GroupBy(x => x.T1 + x.T2 + x.T3 + x.T4 + x.T5, x => x.T1 +","+ x.T2 +","+ x.T3 +","+ x.T4 +","+ x.T5).OrderByDescending(x => x.Count());
var q3 = Team1.GroupBy(x => x.T1 + x.T2 + x.T3 + x.T4 + x.T5, x => x.T1 +","+ x.T2 +","+ x.T3 +","+ x.T4 +","+ x.T5).OrderByDescending(x => x.Count());
var maxTeam1 = q1.FirstOrDefault();
var maxTeam2 = q2.FirstOrDefault();
var maxTeam3 = q3.FirstOrDefault();
具体报错:
解决方案:
先在内存里面开辟一个空间用来存储List。
即在GroupBy之前,添加ToList()方法。
参考答案来源于方案3,但这似乎看起来并不是长久之计。
参考方案:
https://stackoverflow.com/questions/58138556/client-side-groupby-is-not-supported
Today's comments have reached the limit. If you want to comment, please wait until tomorrow (UTC-Time).
There is 18h41m31s left until you can comment.