I have Person entity which has a 1 : N relationship with Person_Addresses
(fields: PersonID
, AddressID
, ValidFrom
). I want to get all Person
records and associated Person_Addresses
with only latest ValidFrom. How should I do this using ObjectQuery or IQueryable?
Edit:
I mentioned ObjectQuery
and IQueryable
, because I wanted to have a solution using extension methods (I think, that how it's called). Also I forgot to mention that I'm using Entity Framework where I have the entities generated. I want to get a person object which has it's person_adress member eagerly loaded.
Here are the entities structure: Person members: int id, string firstname, string lastname, Partner_Address partneradress
Person_Address members: int personid
, int adressid
, date validfrom