LINQ Join for Orderby only
- by RandomBen
I am trying to run this code:
ItemTaxonomy iTaxonomy = from itemTaxonomy in connection.ItemTaxonomy
where itemTaxonomy.Item.ID == itemView.ID
orderby itemTaxonomy.Taxonomy.Name
select itemTaxonomy;
When I compiled it I get the error:
Cannot implicitly convert type
'System.Linq.IOrderedQueryable<Website.Models.ItemTaxonomy>' to
'Website.Models.ItemTaxonomy'. An explicit conversion exists (are you missing a cast?)
I believe the issue is with orderby itemTaxonomy.Taxonomy.Name but I am just trying to order by the name of Taxonomy items instead of their IDs. Is there a way to do that?