Converting ESQL to LINQ to Entities. Sort by related entities
I am using EF + RIA and unfortunately meet some problems with sorting by related entities. For such purpose there is ESQL query that I implemented (found only this solution): var queryESQL = string.Format( @" select VALUE ent from SomeEntities as ent join Attributes as ea ON ea.EntityId = ent.Id where ea.AttributeTypeId = @typeId order by ea.{0} {1}", columnName, descending ? "desc" : "asc"); var query = ObjectContext.CreateQuery<SomeEntity>(queryESQL, new ObjectParameter("typeId", attributeTypeId)); Tables have following structure: <Attribute>: int Id; decimal DecimalColumn; string