AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

HierarchicalModelDataSource<(Of <(<'T>)>)> Class

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.

Namespace:  AdvantageCSP.HierarchicalModelDataSource
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public class HierarchicalModelDataSource<T> : IHierarchicalDataSource
where T : IModelWithHierarchy<T>

Type Parameters

T
A model type that implements IModelWithHierarchy<(Of <(<'T>)>)> (e.g., a Navigation or Category node with Parent/Children references).

Examples


C#
var dataSource = new HierarchicalModelDataSource<NavNode>();
dataSource.DataSource = myNavNodes;  // IEnumerable<NavNode>
treeView.DataSource = dataSource;
treeView.DataBind();

Inheritance Hierarchy


Object
  AdvantageCSP.HierarchicalModelDataSource..::..HierarchicalModelDataSource<(Of <(<'T>)>)>