how can fetch the particular parent and child in one table using linq recursive in mvc asp.net...parent and child are in one table i need to fatch like level1 level 2 and so on...
plz help me
thanks in advance
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mukesh KumarPosted Oct 13, 2015, 1:43 AM
Mukesh KumarPosted Oct 13, 2015, 1:42 AM
This should do the trick, (edit: see below for version that doesn't use Distinct.)
The above code should hopefully generate something quite similar to what it itself looks like in SQL, maybe with the exception of the distinct which might cause it to return more data that is actually needed to be filtered on the client. Something that might become an issue if there's a lot data, chiefly if there's a lot of parents because it will return duplicates of those)
Here is the query reworked without the distinct call
http://weblogs.asp.net/muhanadyounis/parent-child-in-recursive-data-table-with-linq