public class Personel
{
public int Id {set;get;}
public ICollection<Agreement> Agreements { set; get;}
}
public class Agreement
{
public int Id {set;get;}
}
I have a domain model as above and have a dbcontext.
How do I get the last Agreement?
var result = _db.Personels.Include(a=>a.Agreements).OrderByDescending(x => x.Id);
I want to get all the personels and last agreement of them...
This gives me all the agreement of a personel, i want only the last one ordered by id descending.