I use EF 4 and C#.
I need order the result of this query with two Properties belonging to two different Entities.
In my case I would like order by gt.GroupTypeId
and its subset by cnt.ContentId
.
PS: I'm not sure if my title is appropriate, if you think not, let me know I will change it :-)
from cnt in context.CmsContents
from gt in cnt.CmsGroupsTypes
join t in context.CmsTypes
on cnt.TypeContent equals t.TypeContent
join m in context.CmsModes
on cnt.ModeContent equals m.ModeContent
orderby gt.GroupTypeId // Problem here
select new
{
cnt.ContentId,
cnt.Title,
gt.TypeGroup,
gt.GroupTypeId,
TypeContentDescription = t.Description,
ModeContentDescription = m.Description,
cnt.IsPublished
};
Simple example:
var orderedList = cnt.OrderBy(x => x.GroupTypeId).ThenBy(x => x.ContentId);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With