entity framework 4 - EF4 querying from parent to grandchildren -


I have a model with parents, children and grandparents, in which there are many-to-many relationships Excluding one thing not yet known, use the Poko sections that work fine.

When I ask the parent or child directly to use LINQ, SQL executes a COUNT in LINQ query (a .count () database And so on) - Okay. Parents have a child's property for children's access but for the problem (and now for the problem) it does not disclose a IQueryable interface, but an icon . So when I access the property of children on a particular parent all parents are reading more than the children are reading, when I have wives ( theParent.Children.SelectMany (child) = & Gt; child.GrandChildren) Account () ) Then a separate request is issued to select all the data for each child, its grandson has many different questions !

Changing the type of property of IQueryable children from ICollection does not solve it. In addition to the ways to remember me, like Add () and Remove (), EF simply does not recognize the navigation property.

Is the right way to inquire through children (eg: low database interaction) (and what are they)? Or is it just not possible?

An alternative medium I found was starting between the children:

C.GrandChildren); Int cnt = gc.Count ();

At least this gives a SQL-query that returns the number of grandsons and not intermediate data.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -