加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core-mvc – EF7和GroupBy()无法翻译

发布时间:2020-12-16 07:01:59 所属栏目:asp.Net 来源:网络整理
导读:我在EF7 Beta 8上运行以下代码: var locationGrops = from l in db.Locations group l by l.ServiceType into g select g;var list = locationGrops.ToList(); 当我执行此代码时,EF会显示警告. warning : [Microsoft.Data.Entity.Query.QueryCompilationCon
我在EF7 Beta 8上运行以下代码:

var locationGrops = from l in db.Locations
                    group l by l.ServiceType into g
                    select g;

var list = locationGrops.ToList();

当我执行此代码时,EF会显示警告.

warning : [Microsoft.Data.Entity.Query.QueryCompilationContext] The LINQ express
ion 'GroupBy([l].ServiceType,[l])' could not be translated and will be evaluate
d locally.

查询对我来说似乎很基础,SQL中有GROUP BY.有没有办法让它在服务器上运行?

解决方法

此时,EF7不支持group by和大多数子查询.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读