Hierarchical Data - IHierarchyNode Interface
IHierarchyNode interface declares the methods and properties that ensure efficient work with business objects of a tree-like hierarchical structure. IHierarchyNode is an alternative to ITreeNode. ITreeNode is a very abstract description of hierarchical data and does not take into account the specifics of the hierarchy implementation. Therefore, TreeListEditor can operate efficiently with only a small hierarchical data volume (up to 1000 objects). IHierarchyNode logic is specially designed to process parent-child relationship with maximum efficiency.
The text below describes useful features offered for the objects having this interface implemented in them.
Hierarchy Node List Editor and Explorer List Editor allow displaying the hierarchical structure in a List View using ASPxTreeList and TreeList controls from ASPxTreeList and XtraTreeList libraries.
The support of multiple hierarchies allows the user to change the current hierarchy and to modify it in the runtime. The user can also use Drag-and-Drop functionality for hierarchy modifications during runtime.
There are three deletion modes:
- Default – deleting the object and all references to the object; in so doing, all child elements of the object become root elements.
- Replacement – all child elements move up by one position in the hierarchy and end up in the parent's position when the node is deleted.
- Cascade – deleting the object and all its child objects.
One of the following three methods can be used to check whether child elements exist:
- DirectDatabaseCount – sends the "Exists()" request to the DB directly.
- CollectionCount – obtains a collection of child elements and compares the number of elements in the collection to zero.
- Default – DirectDatabaseCount is used if no objects are edited, otherwise CollectionCount is used.
To view the objects that implement the IHierarchyNode interface, refer to Editors | IHierarhyNodeListEditor section in the Feature Center demo installed with Xafari. To see the implementation, refer to the HierarchyNodeEditorObject.cs file.
Web app example:
To learn more about the Hierarchical Data, refer to the following documents:
- Getting Started
- Hierarchy Registration
- Hierarchy Attributes
- Xafari Blog: Hierarchical Data Implementation
- Xafari Blog: IHierarchyNode. Performance Comparison
References