score:2
Accepted answer
if you want to do this without having to write a function to recursively generate a query for each node of the tree, you should consider moving to a nested set architecture rather than a parent/child architecture. this allows for getting a node an all descendants with one query. read this article on the subject for more information: http://www.sitepoint.com/hierarchical-data-database/ (make sure to read the whole thing. the good stuff doesn't start until the second page.)
Source: stackoverflow.com
Related Articles
- CTE recursive query with linq mvc
- LINQ query for an aggregate count with a recursive relationship
- Linq sub query when using a repository pattern with EF code first
- Usage recursive hierarchy tree structure in Linq query with multible tables and return some Json Value
- Avoiding repeating code with Linq query + optional params
- how to write a Linq query with a EF code first Many to Many relationship
- LINQ Recursive query in web api code
- Proper Linq Query for objects with many to many relation ship generated with code first entity framework
- Linq query with nullable sum
- Problem with linq query
- Recursive Hierarchy - Recursive Query using Linq
- Nested "from" LINQ query expressed with extension methods
- How to use index/position with Where in LINQ query language?
- Linq query with Array in where clause?
- Casting to a derived type in a LINQ to Entities query with Table Per Hierarchy inheritance
- How do I most elegantly express left join with aggregate SQL as LINQ query
- How to query an XDocument with LINQ when elements have a colon in their name?
- LINQ query with Distinct and Union
- Selecting multiple columns with linq query and lambda expression
- GroupBy with linq method syntax (not query syntax)
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Simplify process with linq query
- LINQ To SQL: Delete entity (by ID) with one query
- How/Can I use linq to xml to query huge xml files with reasonable memory consumption?
- query a sub-collection of a collection with linq
- Linq query with multiple Contains/Any for RavenDB
- linq to sql recursive query
- LINQ select query with Anonymous type and user Defined type
- Recursive LINQ query: select item and all children with subchildren
- How can I set properties on all items from a linq query with values from another object that is also pulled from a query?
- Assign a user to AspNetUserRole in Console Line Application C#
- If else condition in multiple from in LINQ in C#
- Why does using anonymous type work and using an explicit type not in a GroupBy?
- C# Ternary Operator used in LINQ query
- leaderboard ranking using LINQ rank number and same point
- Querying for a specific value at the intersection of a Row and a Column in a DataTable
- Mock Linq `Any` predicate with Moq
- Linq - Using GroupBy with my own type vs anonymous type
- Selecting documents between user-specified dates using linq with mongodb
- Prepare default new line as replacement of empty values
- reading from xml (linq) to windows form
- LINQ Except operator and object equality
- Dealing with LINQ to Objects when object not found
- Data Transfer Object (DTO) to DisplayObject (DO) - How to flatten DTO's into a DO collection property
- Sorting a `List<object>` by object properties
- Why does the compiler think this is an Object instead of a DataRow?
- Calculated field in model class gives exception
- Sales grouped by month then by product
- LINQ query for Sum and view using View Model Class
- How to do a "Select" in Linq when there is no result