Return all row having a maximum value
Posted on 2010-09-09
I'm using entity framework to connect the database.
I've a table(Let's call it "File") that haves several fields:
ID, Version, XYZ
Primarky key is based on ID AND Version.
so I can have several line with the same ID but different version(and inversly).
The question is:
How can I, with a LAMBDA expression, ask my Entity Framework, to return me all last version of a "file".
!! The goal is that the database doesn't need to return all rows, and is called only one time, so forget solution like GetAllRows and read the whole collection and save only the latest, or get a list of all possible ID and get the last version foreach in another request. Thanks!