Search code examples
hierarchical-dataaspnetboilerplatedevextreme

ABP AppService for hierarchical data


I need an AppService to load a treeview with a recursive collection of entities like these:

===Products===
Id
Description
Price
Products[] ====> Id
                 Description
                 Price
                 Products[]

           ====> Id
                 Description
                 Price
                 Products[] ====> Id
                                  Description
                                  Price
                                  Products[]

Is there a ready-made class to derive from? If not, could you suggest what class to derive or what interface to implement, and how to proceed, please?

PS: Possibly with full CRUD operations, but the most important is understand how to load the data.


Solution

  • _productRepository .GetAllIncluding(x=>x.Products) .Where(p => p.Id == 1); // or whatever condition .ToList()

    this will give you the list of products and child products of the product with Id 1.