AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

AdvantageCSP.HierarchicalModelDataSource Namespace

Classes


  Class Description
Public class HierarchicalModelDataSource<(Of <(<'T>)>)>
A generic IHierarchicalDataSource that binds a collection of models implementing IModelWithHierarchy<(Of <(<'T>)>)> to hierarchical data-bound controls.

Usage: Set the DataSource property with your hierarchy-aware collection, then assign this instance to a control's DataSource property and call DataBind().

Pipeline: When a control calls GetHierarchicalView(String), this class converts the DataSource collection into a HierarchicalModelList (via [HierarchyConverter.ToHierarchicalModelList{T}]), wrapping each model in a HierarchyData<(Of <(<'T>)>)> adapter. The view is cached after the first call so repeated binds don't rebuild the tree.

Public class HierarchicalModelDataSourceView
The data source view used by HierarchicalModelDataSource<(Of <(<'T>)>)>. Hierarchical data-bound controls call Select()()()() during data binding to obtain the root-level nodes of the hierarchy. This view simply returns the pre-built HierarchicalModelList that was passed in at construction time.

This class completes the hierarchical data-binding pipeline: HierarchicalModelDataSourceHierarchicalModelDataSourceView (Select) → HierarchicalModelList → individual HierarchyData nodes.

Public class HierarchicalModelList
A strongly-typed list of [IHierarchyData] nodes that also implements [IHierarchicalEnumerable], making it directly consumable by hierarchical data-bound controls.

Instances are created by [HierarchyConverter.ToHierarchicalModelList{T}] and by [HierarchyData{T}.GetChildren]. Each element in the list is typically a [HierarchyData{T}] adapter wrapping a model.

Public class HierarchyConverter
Provides the [ToHierarchicalModelList{T}] extension method that converts a collection of IModelWithHierarchy<(Of <(<'T>)>)> models into a HierarchicalModelList for use with hierarchical data binding. This is the primary entry point for bridging models into the IHierarchyData/IHierarchicalEnumerable infrastructure.
Public class HierarchyData<(Of <(<'T>)>)>
Adapter that wraps a model implementing IModelWithHierarchy<(Of <(<'T>)>)> to satisfy the IHierarchyData contract. This is the bridge that allows tree data-bound controls to navigate and render a custom object hierarchy.

Instances are created by [HierarchyConverter.ToHierarchicalModelList{T}] and are not typically constructed directly by application code.

Interfaces


  Interface Description
Public interface IModelWithHierarchy<(Of <(<'T>)>)>
Contract for models that participate in a tree structure and can be bound to hierarchical data-bound controls via HierarchicalModelDataSource<(Of <(<'T>)>)>.

Implementors must expose their underlying data object via Item, a reference to their parent node via Parent, and a list of child nodes via Children. The [HierarchyConverter.ToHierarchicalModelList{T}] extension method wraps implementors in HierarchyData<(Of <(<'T>)>)> adapters for data binding.