how can I code a recursive query in an Entity Framework model?
Posted
by Greg
on Stack Overflow
See other posts from Stack Overflow
or by Greg
Published on 2010-05-30T12:02:48Z
Indexed on
2010/05/30
12:22 UTC
Read the original article
Hit count: 1322
Hi,
I have a model which includes NODES, and RELATIONSHIPS (that tie the nodes together, via a parent_node, child_node arrangement).
Q1 - Is there any way in EF / Linq-to-entities to perform a query on nodes (e.g. context.Nodes..) to find say "all parents" or "or children" in the graph?
Q2 - If there's not in Linq-to-entities, is there any other way to do this other than writing a method that manually goes through and doing it?
Q3 - If manual is the only way to do it, should I be concerned about the number of database hits that will be going out to the database as the method keeps recursing through the data? Or more specifically, is there any EF caching type feature that might assist here in ensuring the method is performance from a "number of database hits" point of view?
thanks
thanks
© Stack Overflow or respective owner