views:

150

answers:

2

I'm using the query below:

public IEnumerable<QUESTIONARIO_BASE> ListQuestionario()
{
    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?

A: 

Use this tip: How to sort Relationships in Entity Framework

Craig Stuntz
A: 

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
    }
}
John Prado