Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
SQL
var EmpList = _service.GetAllEmployeeDuty().OrderByDescending(x => x.EndDate).GroupBy(x => x.Employee_Id).Select(x => x.First()).ToList();

I tried it my way,but its give exception that EF DOES not support Select(x => x.First())?
Posted
Comments
[no name] 17-Nov-15 0:24am    
What x.First() is returning in your code ?
Krunal Rohit 17-Nov-15 0:25am    
Strange.

-KR
Maciej Los 17-Nov-15 3:52am    
What output you do expect?
Example data might help to understand your issue...
Sajid227 17-Nov-15 5:33am    
there are a number of record against one employee in this table ,i want to get last record of each employee in the list

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900