Skip to content

LINQPadCustomVisualizer

Jeremy Thomas edited this page Dec 11, 2017 · 2 revisions

Four LINQPad Custom Visualizers

I have created two packages of LINQPad Custom Visualizers, the first, AW.LinqPadCustomVisualizers.V2.0.zip , is non-LLBLGen Pro specific and exposes these 3Controls to LINQPad to be displayed in the output panel: the GridDataEditor, HierarchyEditor and Object Inspector. The second package is my LLBLGen Pro Data Driver which contains the first package with additional LLBLGen Pro specific calls to those visualizers, plus an additional control: theEntity Explorer.

1: DisplayInGrid

This displays the results of a LINQPad query in the GridDataEditor in the output panel to enable filtering of the data via the UI and editing ofLLBLGen Pro entities, as theLINQPad grid can only edit LINQToSQL entities. DisplayInGrid shows the normal properties that a datagridview would show plus public fields - this has been done as it seems the automatic LINQToSQL datacontext uses fields rather than properties. DisplayInGrid returns an empty enumeration rather than void simply so it can be used with theLINQPad expression language where the output gets piped to the dump command which throws and error if it returns void.

Saving changes

To save the changes to the DB a DataEditorPersister must be supplied, except for LINQToSQL and LLBL queries, where there are extension methods which use built-in LINQToSQL and LLBL DataEditorPersisters. If no DataEditorPersister is provided then the GridDataEditor will be in a readonly mode.

Example

NutShell DB (included with LINQPad samples)

Customers.DisplayInGrid()

Usage

Call one of the overloads and variations of the DisplayInGrid extension method listed here:LLBL, Other

2: DisplayHierarchyInTree

This displays the results of a LINQPad query in the HierarchyEditor in the output panel for displaying and editing Adjacency List (self referencing) data in a tree.

Example

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

Employee.ToEntityCollection().DisplaySelfServicingHierarchyInTree("EmployeeID", "ManagerID", "EmployeeDisplayName") 

Which display in the LINQPad output panel like so: image As well as the treeview there is a propertygrid showing the currently selected node and a grid showing all the children of that node.

Usage

Call one of the overloads and variations of the DisplayHierarchyInTree extension method listed here:LLBL, Other 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 anDataEditorPersister to persist any changes you make.

3: Inspect

This displays an Object Inspector for browsing the properties of an object and any objects it references in the output panel.

Example

NutShell DB (included with LINQPad samples)

Customers.First().Inspect()

4: Explore

This displays an Entity Explorer to browse and edit LLBLGen Pro entities from a database in the output panel.

Example

this.Explore()

Usage

Call the Explore extension method listed here: LLBL

Installation

If you are using the LLBLGen Pro Data Context Driver this is included and should be available for queries using this driver. If not, download AW.LinqPadCustomVisualizers.V2.0.zip and then unzip to the LINQPad plugins folder (usually %USERPROFILE%\Documents\LINQPad Plugins).

For version history see release notes in download pages: Version 2.0, Version 1.0

Other LINQPad Custom Visualizers

Clone this wiki locally