Sunday 15 May 2011

entity framework 5 - How do you sort a parent collection and child collection of entities? -


Is there a way to sort both an inlcuded child collection and parental collection? I am using institutions with LINQ and EF 5.0.

Here is my query that does not work if I take orders in order to join it, then it works just fine except that the list of children is not solved.

  Return (Include parent (s) in m_Context.Parents (p = & gt; p; Order B (C = & gt; C. Child Information .name). C => C. Child Information) Order by the parent. Choose Name Parents. Olist ();   

For example

  • C2
  • P>
  • C2
  • C2
  • C2
  • C2
  • C2 <
  • C3

  • < P>

    C2

  • P2

    • C3
    • C1
    • C2 assign the result of the trim for the parent. Children public relations operators), but you can return anonymous items with the parents who are interested and sorted out without adding the children to the parents Returned children can:
        Return (Parents in Parents Parents by the Guardian. Select the Name New {Parents = Parents, Children = Parents Child.orderbie (c => C.ChildInformation.Name)}). ToList ();   

      or retrieve the parents and sort the children in memory.

  • No comments:

    Post a Comment