C4Diagram Class
A C4 diagram of a software architecture: people, systems, containers and components, grouped in boundaries or deployment nodes, and the relationships between them (Mermaid C4Context, C4Container, C4Component, C4Dynamic and C4Deployment). As in Mermaid, the elements are placed in rows in the order they are declared, not by an automatic layout.
public sealed class C4Diagram : Diagram- Inheritance
DiagramC4Diagram
Constructors
| Name | Description |
|---|---|
| C4Diagram() |
C4Diagram()
C4Diagram.cspublic C4Diagram()No documentation is available.
Properties
| Name | Description |
|---|---|
| Boundaries | Gets the top-level boundaries. |
| BoundariesPerRow | Gets or sets how many boundaries a row has, at most. The default is 2 (Mermaid c4BoundaryInRow). |
| Elements | Gets the elements that are in no boundary. |
| Kind | Gets or sets the kind of the diagram. A C4DiagramKind.Dynamic diagram numbers its relationships. |
| Relationships | Gets the relationships, drawn in order. |
| ShapesPerRow | Gets or sets how many elements a row has, at most. The default is 4 (Mermaid c4ShapeInRow). |
| Wrap | Gets or sets a value that indicates whether the texts wrap to the width of the elements. The default is true. |
Boundaries
C4Diagram.csBoundariesPerRow
C4Diagram.csElements
C4Diagram.csGets the elements that are in no boundary.
Property value
Kind
C4Diagram.csGets or sets the kind of the diagram. A C4DiagramKind.Dynamic diagram numbers its relationships.
public C4DiagramKind Kind { get; set; }Property value
Relationships
C4Diagram.csGets the relationships, drawn in order.
public IList<C4Relationship> Relationships { get; }Property value
ShapesPerRow
C4Diagram.csWrap
C4Diagram.csMethods
| Name | Description |
|---|---|
| AddBoundary(string, DiagramText, C4BoundaryKind) | Adds a top-level boundary. |
| AddElement(string, C4ElementKind, DiagramText, DiagramText?) | Adds an element that is in no boundary. |
| AddRelationship(C4Item, C4Item, DiagramText, string?) | Adds a relationship. |
| EnumerateBoundaries() | Enumerates the boundaries and their nested boundaries, depth first. |
| Find(string) | Finds an element or a boundary by identifier. |
AddBoundary(string, DiagramText, C4BoundaryKind)
C4Diagram.csAdds a top-level boundary.
public C4Boundary AddBoundary(string id, DiagramText label, C4BoundaryKind kind = C4BoundaryKind.Boundary)Parameters
idstring- The identifier (Mermaid alias).
labelDiagramText- The name.
kindC4BoundaryKind- The kind.
Returns
C4Boundary The boundary.
AddElement(string, C4ElementKind, DiagramText, DiagramText?)
C4Diagram.csAdds an element that is in no boundary.
public C4Element AddElement(string id, C4ElementKind kind, DiagramText label, DiagramText? description = null)Parameters
idstring- The identifier (Mermaid alias).
kindC4ElementKind- The kind.
labelDiagramText- The name.
descriptionDiagramText?- The description, or
nullfor none.
Returns
C4Element The element.
AddRelationship(C4Item, C4Item, DiagramText, string?)
C4Diagram.csAdds a relationship.
public C4Relationship AddRelationship(C4Item from, C4Item to, DiagramText label, string? technology = null)Parameters
fromC4Item- The source.
toC4Item- The target.
labelDiagramText- The text.
technologystring?- The technology, shown between brackets below the text, or
nullfor none.
Returns
C4Relationship The relationship.
EnumerateBoundaries()
C4Diagram.csEnumerates the boundaries and their nested boundaries, depth first.
public IEnumerable<C4Boundary> EnumerateBoundaries()Returns
IEnumerable<C4Boundary> The boundaries.