Tool for automatic generation of documentation in the form of images. Using Reflections. Find all the classes, which have a custom attribute. Get their links in the form of a graph. Generate file for GraphViz. Visualize your links between DTO. Customize colors and labels.
-
Implement your theme (IGraphvizTheme) or get DefaultTheme (IGraphvizTheme) from MicroDocum.Themes.DefaultTheme
-
Mark your DTO with your custom attributes and custom interfaces
[LabelAlt("altLabel")]
[Tags("someTag")]
[TagsAlt("altTag")]
[TTL(10)]
[ServiceName("Test")]
public class Struct1 : IProduce<IInterface1>
{
}
- Analize your assembly
var a = new AssemblyAnalizer<DefaultLinkStyle>(theme);
var asm = AppDomain.CurrentDomain.GetAssemblies();
var graph = a.Analize(asm, theme.GetAvailableThemeAttributes(), t => t.FullName?.StartsWith(_classname) ?? false);
- Generate Graphviz file
var graphwizFileData = new GraphvizDotGenerator<DefaultLinkStyle>(theme);
- Visualize by online tool https://dreampuf.github.io/GraphvizOnline/ or generate image locally
Install-Package GraphViz.NET
Install-Package GraphViz
using GraphVizWrapper;
using GraphVizWrapper.Commands;
using GraphVizWrapper.Queries;
var getStartProcessQuery = new GetStartProcessQuery();
var getProcessStartInfoQuery = new GetProcessStartInfoQuery();
var registerLayoutPluginCommand = new RegisterLayoutPluginCommand(getProcessStartInfoQuery, getStartProcessQuery);
var wrapper = new GraphGeneration(getStartProcessQuery,
getProcessStartInfoQuery,
registerLayoutPluginCommand);
byte[] bytes = wrapper.GenerateGraph(graphwizFileData, GraphVizWrapper.Enums.GraphReturnType.Png);
SaveResultImage(bytes, $"./{TestContext.CurrentContext.Test.FullName}.png");
https://github.com/RouR/ToDo-ToBuy/blob/ff367c92ce21d1bf9ebea40438965d6fa1c9d23d/build/Microdocum.cs#L37 https://github.com/RouR/ToDo-ToBuy/blob/ff367c92ce21d1bf9ebea40438965d6fa1c9d23d/DTO_routing.png