如何将以下查询更改为EF [英] How do I change following query into EF

查看:110
本文介绍了如何将以下查询更改为EF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的查询实际上是使用氧代码生成器生成的,我想将其更改为EF Menthod查询,此查询返回所有员工最终记录列表

I have a query that is in fact generated using oxygen code generator ,i want to change it into EF Menthod query,this query return me all employee final record list

var EmpList = _service.GetAllEmployeeDuty().OrderByDescending(x => x.EndDate).GroupBy(x => x.Employee_Id).Select(x => x.First()).ToList();



我按照我的方式尝试了,但它给出了EF不支持Select的例外(x => x.First())?


I tried it my way,but its give exception that EF DOES not support Select(x => x.First())?

推荐答案

EF支持第一个方法。看看这里:支持和不支持的LINQ方法(LINQ to Entities) [ ^ ],但有一套已知问题和注意事项LINQ to Entities [ ^ ]



请点击链接。
EF supports First method. Have a look here: Supported and Unsupported LINQ Methods (LINQ to Entities)[^], but there is a set of Known Issues and Considerations in LINQ to Entities[^]

Please, follow the links.


这篇关于如何将以下查询更改为EF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆