dotPeek 2016.2 Help

Exploring Type Dependency Diagram

Inspect | Show Type Dependency Diagram

dotPeek allows you to visually study how types depend on each other in your solution.
In the type dependency diagram, you can add any number of types from different projects or
compiled assemblies and visualize different kinds of dependencies between them.

Building the initial diagram

There are several ways to build a new type dependency diagram:

Set the caret anywhere in the code viewer, and choose
Inspect | Show Type Dependency Diagram
in the main menu or
invoke the
Inspect This
command (
press
Ctrl+Shift+Alt+A), and then choose
Show Type Dependency Diagram.
In this case, all types from the file are added to the diagram, and aggregation, usage, and inheritance
dependencies
are visualized.

In the result list of the
Go to Base Symbols,
Go to Derived Symbols,
Navigate to Exposing APIs
or similar commands, press
Alt+Num+
or click
Show on Diagram
In case of base/derived symbols, the corresponding part of the inheritance hierarchy is added to the
diagram and only inheritance
dependencies
are visualized.
In case of the exposing APIs, the diagram displays types containing methods that return the given type
and only return type
dependencies.

The newly created project dependency diagram is displayed in a new tab of the
Hierarchy Window.

Note that the diagram is not synchronized with the solution, i.e. if you rename or delete types in your
code,
the diagram is not changed.
To see whether the diagram is up to date, you can check the creation time displayed in the
bottom right corner.
You can also rebuild the diagram by clicking
Refresh Type Dependencies
on the toolbar.

Adjusting the view of the diagram

Type dependency diagram can be laid out in two ways:

Inheritance Hierarchy Layouter
- this option arranges types according to their inheritance relations:
the base types are moved upward.

Business Logic Layouter
- this option arranges types according to all displayed relations between them.

You can switch between these options using the corresponding selector in the left:

To pan and zoom the diagram, use the controls in the upper left corner of the diagram area.
Alternatively, you can click anywhere in the diagram area
outside the diagram items and drag while the hand cursor
is shown.
For zooming, you can also use the mouse wheel.

The diagram layout is calculated automatically, but you can change it if necessary:
all items can be moved.
To move an item (a type, a dependency link, or a grouping item), first click on it to select,
and then click and drag it while the cross cursor
is shown.

If necessary, you can collapse and expand grouping items in the diagram in one of the following ways:

Click on the down arrow in the left top corner of the grouping item.
When collapsed, the sign changes into an up arrow and you can click on it to expand the item.

Select a grouping item in the diagram and press
Ctrl+LeftArrow
and
Ctrl+RightArrow.

Adding and removing items on the diagram

At any moment, you can modify the displayed diagram so that only desired types are displayed.
If necessary, you can reverse changes made in the diagram (added/removed items) step by step
by clicking
Undo
or pressing
Ctrl+Z. To reverse the
Undo
commands, click
Redo
or press
Ctrl+Y.

When your focus is anywhere in the diagram area, you can start typing to find and add
types from the entire solution.

To remove types and folders from the diagram, either use the cross in the right top corner of grouping items
or press
Delete
while the items are selected.
Alternatively, select items you want to keep, right-click the selection and choose
Show Only Selected Items
in the context menu.
For multiple selection,Ctrl-click items.

There are also several ways to add items to the diagram:

Select a type in the code viewer and drag-n-drop the selected type to the diagram.

To find and add all referenced types, right-click on a type or a grouping item and choose
Add all referenced types
in the context menu.
If you invoke this command on a grouping item (folder or project),
dotPeek adds referenced types for all types that are currently shown.

To find and add types by name from the currently loaded assemblies and referenced assemblies,
start typing the name in the search box.
You can use wildcards (e.g. the asterisk '*') and CamelHumps while typing:
Select a type and press
Enter
or click on it to add it to the diagram.
Types highlighted with green in the drop-down are already added to the
diagram. If you select such type, the diagram focus moves to it.

In the
details
pop-up,
click on any related type to add it, or use the
Add all used types to the diagram,
Add all usages to the diagram,
Add all base types, and
Add all immediate inheritors
links to add multiple types.

To speed up laying out the diagram, disable all
dependency filters
before you add a lot of new types to the diagram
or expand a large grouping node, and then enable the necessary filters again.

Studying specific types and containers

When a node is collapsed, you can hover a mouse over it and quickly check out what is inside.
In the pop-up that appears, you can see the number of types added to the diagram within this node and
all modules referenced from within this node:

If necessary, you can click on referenced modules and/or click
Add missing items
to add other items from this node to the diagram.

You can double-click on any type to open it in the editor.
If the type is defined in a compiled assembly, it is opened according to your preferred way of
navigating to compiled code.

You can get the detailed information on any specific type
(as well as on any
dependency
between types).
To get details of a type, hover the mouse over it, and as soon as the details pop-up appears,
move the mouse pointer on it.

On the type details popup, you will see which types the given types uses,
where the type is used, inherited types, types use in constructor parameters and more.
If the type has XML documentation, the summary is also displayed on the pop-up.

You can click on types to add them to the diagram.
Types highlighted with green are already added to the diagram.
If you click on such type, the diagram focus moves to it.
The
Go to declaration
link in the top upper corner allows you to open the type in the editor.

Studying dependencies between types

On the type dependency diagram, you can visualize several kinds of dependencies.
To show or hide specific kinds of dependencies, use the corresponding items in the
Filter Dependencies
selector:

Aggregation Dependencies
- displays a kind of dependency when a type is a collection or container of other types,
This kind of dependency is shown as a green dotted line.
Name of the corresponding field is shown next to the line.
You can hover the mouse over this line to see the field declaration and navigate to the
corresponding place in the editor.

Usages Dependencies
- displays a kind of dependency when variables, parameters or method returns
of one type are used in another type.
This kind of dependency is shown as a blue line whose thickness reflects a relative number of usages.
You can hover the mouse over this line to see the list of usages:
Clicking on specific usages will bring you to the corresponding place in the text editor,
clicking on the
Show all usages
link opens all usages in the
Find Results Window.

Inheritance Dependencies
- displays a kind of dependency when one type extends or implements another type.
This kind of dependency is shown as a grey line.
You can hover the mouse over this line to see the inheritance relation and navigate to the
corresponding place in the editor.
Transitive inheritance dependencies are shown using dashed lines.
You can hover the mouse over such lines and use the popup to check the types though which the
dependency goes and add these types to the diagram by clicking on them.

Return Type Dependencies
- displays a kind of dependency when one type has methods or properties that return another type.
This kind of dependency is shown as a violet line.
You can hover the mouse over this line to see the list of members and navigate to the
corresponding places in the editor.

Constructor Injection
- displays a kind of dependency when one type is exposed as a constructor parameter of another type.
This kind of dependency is shown as a brown line.
You can hover the mouse over this line to see the constructors and navigate to the
corresponding places in the editor.

Invoking other dotPeek features on the diagram

Navigating from items on the diagram

To list all available navigation destinations of any item in the
Navigate to
menu, press
Ctrl+Shift+G
or right-click the item and choose
Navigate To.

You can locate any item (file, folder, or project)
in the Assembly Explorer
by pressing
Shift+Alt+L
when the item is selected.

You can also list related usages by clicking
Show all used types in find results window
or
Show all usages in find results window
in the
details pop-up
of a type or
Show all usages
in the pop-up of a
dependency link.

Exporting Diagram to image

At any point of exploring dependencies, you can export the current view to an image.
To do so, click
Export to PNG
and specify where to save the image file.

This feature is inspired by and borrowed from
JetBrains ReSharper,
a developer productivity tool for Microsoft Visual Studio.