Answer the question
In order to leave comments, you need to log in
How to sort by related entity field in Entity Framework via shadow property?
result = await DbSet.Where(x => x.ParentId == parentId)
.Include(x => x.CreationUser)
.Include(x => x.ModifiedUser)
//.OrderBy(x => x.ModifiedUser.LastName)
.OrderBy(x => EF.Property<object>(x.ModifiedUser, "LastName"))
.Skip(pageSize * (pageNumber - 1))
.Take(pageSize)
.ToArrayAsync();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question