我有以下Entity Framework Core 3.0:
var units = await context.Units
.SelectMany(y => y.UnitsI18N)
.OrderBy(y => y.Name)
.GroupBy(y => y.LanguageCode)
.ToDictionaryAsync(y => y.Key, y => y.Select(z => z.Name));
Run Code Online (Sandbox Code Playgroud)
我得到以下错误:
Client side GroupBy is not supported.
Run Code Online (Sandbox Code Playgroud)
如果未在客户端上运行查询,为什么会出现此错误?
要在客户端或客户端的一部分上运行查询,我将执行以下操作:
var units = context.Units
.SelectMany(y => y.UnitsI18N)
.OrderBy(y => y.Name)
.AsEnumerable()
.GroupBy(y => y.LanguageCode)
.ToDictionary(y => y.Key, y => y.Select(z => z.Name));
Run Code Online (Sandbox Code Playgroud)
现在可以了...