Re: problem implementing IHierarchyData



I've seen that example, but I don't fully understand it.

Take this code for example, taken from the example I posted a link to
previous post:
public IHierarchyData GetParent() {
foreach (Category category in Common.GetCategoryData()) {
if (category.CategoryId == this.ParentId)
return category;
}
return null;
}

When I implement IHierarchyData interface into my Category class, then I see
it as bad to all the time call BLL method to get the collection of
categories, in the code above GetCategoryData is called for each iteration
in the loop... I want to implement it so that I can choose between
retrieving the full tree (all categories), or just a branch.. So I need
somehow to send in that parameter....

any suggestions


.