D2.Net
0.2.0
See the version list below for details.
dotnet add package D2.Net --version 0.2.0
NuGet\Install-Package D2.Net -Version 0.2.0
<PackageReference Include="D2.Net" Version="0.2.0" />
paket add D2.Net --version 0.2.0
#r "nuget: D2.Net, 0.2.0"
// Install D2.Net as a Cake Addin #addin nuget:?package=D2.Net&version=0.2.0 // Install D2.Net as a Cake Tool #tool nuget:?package=D2.Net&version=0.2.0
About
This library aims to provide a simple and expressive way to create D2 templates that can be easily integrated into any .NET application. Enabling easy generation of diagrams for documentation, reports, and more based off of data from your application.
Currently this library is in early development and not all D2 features are supported, see below for a high level list of supported features.
Supported D2 Features
- Shapes
- Labels
- Containers / Children
- Styling
- Connections
- Labels
- Arrow Styling/Directions
- Styling
- Tooltips / Links
- Icons
- Standalone Text / Markdown / LateX
- Sequence Diagrams
- UML/Class Diagrams
- SQL Table Diagrams
Installation
D2.Net is available on NuGet.
dotnet add package D2.Net
Usage
Here is an example of creating a basic template using D2.Net.
using D2;
var A = new Shape("A", "Starting Point");
var B = new Shape("B", "Ending Point");
var C = new Shape("C", "Middle Point", ShapeType.Hexagon);
var basicTemplate = Diagram.Create()
.Add(A)
.Add(B)
.Add(C)
.Add(new Connection(A, C))
.Add(new Connection(C, B, "Hello World!"));
// Each component overrides ToString() to return the D2 code for that instance
Console.WriteLine(basicTemplate);
// or you can use the Render() method
Console.WriteLine(basicTemplate.Render());
This will output the following D2 code:
A: Starting Point
B: Ending Point
C: Middle Point {
shape: hexagon
}
A -> C
C -> B: Hello World!
That can then be rendered to a diagram using the D2 Playground!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.