-
Notifications
You must be signed in to change notification settings - Fork 5
LINQPadHierarchyEditor
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.
Same as for the LINQPad DataEditor.
Call one of these extension methods: {code:c#} public static IEnumerable ShowHierarchyInTree(this IEnumerable enumerable, string iDPropertyName, string parentIDPropertyName, string nameColumn) public static IEnumerable ShowHierarchyInTree(this IEnumerable enumerable, string iDPropertyName, string parentIDPropertyName, string nameColumn, IGridDataEditorPersister gridDataEditorPersister)
public static IEnumerable ShowSelfServicingHierarchyInTree(this IEnumerable enumerable, string iDPropertyName, string parentIDPropertyName, string nameColumn) where T : EntityBase public static IEnumerable ShowAdapterHierarchyInTree(this IQueryable query, string iDPropertyName, string parentIDPropertyName, string nameColumn) where T : EntityBase2 public static IEnumerable ShowHierarchyInTree(this IEnumerable enumerable, IDataAccessAdapter dataAccessAdapter, string iDPropertyName, string parentIDPropertyName, string nameColumn) where T : EntityBase2 {code:c#}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.
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:
{code:c#}
Employee.ToEntityCollection().ShowSelfServicingHierarchyInTree("EmployeeID", "ManagerID", "EmployeeDisplayName")
{code:c#}which opens a windows like so:
As well as the treeview there is a propertygrid showing the currently selected node and a grid showing all the children of that node.