What is the best way to retrieve hierarchical data using Linq2Sql? I have a tree of data and i want to pull it out and put it in my own classes. The data is for a menu and I have a menu class which has children which are menu items these children in turn have children etc... I want to pull the whole tree and place it into my own classes. The most logical way i could think of doing this was to have an extension method that can recursively convert EntitySet to List i would then call this from m in DataContext.Menus where m.ID == ID select new Menu(){ Name = m.Name, ID = m.ID, Childen = m.LinqMenuItems.ToChildren()}; The ToChildren would then recursively convert all LinqMenuItems and their Children LinqMenuItems to my MenuItem implementation. The problem with this approach is that I get an error saying ToChildren doesn't have a translation to SQL. Seemingly I cant use my own extension methods in a Linq2Sql query. Any Ideas?
srulyt
Posts
-
Get Hierarchical Data Using Linq2Sql -
You've been coding too long when...I think i do all of the above :) You have been coding (for the web) to long when ... when you try to url-escape your local file names you take notes in pseudocode when putting a space between the two words in a compound noun makes you feel like somthing is wrong you don't understand whey when you put a dot after a word in your email you don't get intellisense you can't figure out why other (non tech) people can't understand your emails //shopping list select 2 potatos from potatos where potatos look nice if NiceBananas = true; get a few bananas // i assume you know we have oranges at home if we have < 4 oranges buy some of those 2 i do this all the time and then have to rewrite the email before i send it :-D
-
looking for a place to sell a scriptsomeone i know has developed an ajax based smart navigation tool and is looking for sites that sell these types of tools where can i find such a site or sites?
-
Orcas Express EditionsDoes anyone know if orcas will be released in express editions and if yes when?