I'm using the query below:
public IEnumerable<QUESTIONARIO_BASE> L开发者_如何学运维istQuestionario()
{
var query = (from c in _entities.QUESTIONARIO_BASESet
.Include("QUESTAO_BASE")
.Include("QUESTAO_BASE.DIMENSAO")
.Include("QUESTAO_BASE.RESPOSTA_BASE")
select c);
return query.ToList();
}
And wants to order the sub sets QUESTAO_BASE and QUESTAO_BASE.RESPOSTA_BASE.
After google a lot and use much of examples found here I still not figure out how to accomplish this.
Anyone knows how to order the subsets and return a typed data?
You always can change the order of collections in your view layer.
Ex:
foreach (var item in Model){
{
foreach (var itemQuestaoBase in **item**.QUESTAO_BASE.OrderBy(a => a.ORDEM)){
//DO STUFF IN VIEW
}
}
Use this tip: How to sort Relationships in Entity Framework
精彩评论