LINQPad Hierarchy Editor

Hierarchy editor for displaying and editing Adjacency List(self referencing) data in a tree.
It is based upon an enhanced version of this Databound TreeView control.

Installation

Same as for the LINQPad DataEditor.

Usage

Call one of these extension methods:
public static IEnumerable<T> ShowHierarchyInTree<T>(this IEnumerable<T> enumerable, string iDPropertyName, string parentIDPropertyName, string nameColumn)
public static IEnumerable<T> ShowHierarchyInTree<T>(this IEnumerable<T> enumerable, string iDPropertyName, string parentIDPropertyName, string nameColumn, IGridDataEditorPersister gridDataEditorPersister)

public static IEnumerable<T> ShowSelfServicingHierarchyInTree<T>(this IEnumerable<T> enumerable, string iDPropertyName, string parentIDPropertyName, string nameColumn) where T : EntityBase
public static IEnumerable<T> ShowAdapterHierarchyInTree<T>(this IQueryable<T> query, string iDPropertyName, string parentIDPropertyName, string nameColumn) where T : EntityBase2
public static IEnumerable<T> ShowHierarchyInTree<T>(this IEnumerable<T> enumerable, IDataAccessAdapter dataAccessAdapter, string iDPropertyName, string parentIDPropertyName, string nameColumn) where T : EntityBase2
You need to supply the name of the identity property, the parent property name and the name of the property to be displayed in the tree. You can optionally supply an IGridDataEditorPersister to persist any changes you make.

Example usage

An example of this data is the HumanResources.Employee table in the adventureworks DB.

Here is a LINQPad file showing how to view this data in the HierarchyEditor: LLBL_ShowEmployeesInTree.linq
It's just one line shown here:
Employee.ToEntityCollection().ShowSelfServicingHierarchyInTree("EmployeeID", "ManagerID", "EmployeeDisplayName") 
which opens a windows like so:
HierarchyEditor.PNG
As well as the treeview there is a propertygrid showing the currently selected node and a grid showing all the children of that node.

Last edited Aug 26, 2010 at 9:36 AM by JezzaT, version 8

Comments

No comments yet.