ErDiagram Class

An entity relationship diagram: entities with their attributes, linked by relationships whose ends show their cardinality in crow's foot notation, grouped in subgraphs (Mermaid erDiagram).

public sealed class ErDiagram : Diagram
Inheritance
Diagram ErDiagram

Constructors

NameDescription
ErDiagram()

ErDiagram()

ErDiagram.cs
public ErDiagram()

No documentation is available.

Properties

NameDescription
ClassDefinitionsGets the styles of the CSS classes of the elements, by name (Mermaid classDef). The class default applies to every entity.
DirectionGets or sets the direction of the relationships. The default is DiagramDirection.TopToBottom.
EntitiesGets the entities, in the subgraphs or not. The entities of the subgraphs that are not in this list are drawn too.
NodeSpacingGets or sets the space between two entities of the same rank, in pixels.
RankSpacingGets or sets the space between two ranks, in pixels.
RelationshipsGets the relationships, drawn in order.
SubgraphsGets the top-level subgraphs.

ClassDefinitions

ErDiagram.cs

Gets the styles of the CSS classes of the elements, by name (Mermaid classDef). The class default applies to every entity.

public IDictionary<string, DiagramStyle> ClassDefinitions { get; }

Direction

ErDiagram.cs

Gets or sets the direction of the relationships. The default is DiagramDirection.TopToBottom.

public DiagramDirection Direction { get; set; }

Property value

DiagramDirection

Entities

ErDiagram.cs

Gets the entities, in the subgraphs or not. The entities of the subgraphs that are not in this list are drawn too.

public IList<ErEntity> Entities { get; }

Property value

IList<ErEntity>

NodeSpacing

ErDiagram.cs

Gets or sets the space between two entities of the same rank, in pixels.

public double NodeSpacing { get; set; }

Property value

double

RankSpacing

ErDiagram.cs

Gets or sets the space between two ranks, in pixels.

public double RankSpacing { get; set; }

Property value

double

Relationships

ErDiagram.cs

Gets the relationships, drawn in order.

public IList<ErRelationship> Relationships { get; }

Property value

IList<ErRelationship>

Subgraphs

ErDiagram.cs

Gets the top-level subgraphs.

public IList<ErSubgraph> Subgraphs { get; }

Property value

IList<ErSubgraph>

Methods

NameDescription
AddEntity(string, DiagramText?)Adds an entity.
AddRelationship(ErElement, ErElement, ErCardinality, ErCardinality, DiagramText?)Adds a relationship.
AddSubgraph(string, DiagramText?)Adds a top-level subgraph.
EnumerateSubgraphs()Enumerates the subgraphs and their nested subgraphs, depth first.
Find(string)Finds an entity or a subgraph by identifier. A subgraph hides an entity of the same name.

AddEntity(string, DiagramText?)

ErDiagram.cs

Adds an entity.

public ErEntity AddEntity(string id, DiagramText? label = null)

Parameters

id string
The name of the entity, which is shown when there is no label.
label DiagramText?
The name shown instead of the identifier (Mermaid alias), or null.

Returns

ErEntity The entity.

AddRelationship(ErElement, ErElement, ErCardinality, ErCardinality, DiagramText?)

ErDiagram.cs

Adds a relationship.

public ErRelationship AddRelationship(ErElement from, ErElement to, ErCardinality fromCardinality, ErCardinality toCardinality, DiagramText? label = null)

Parameters

from ErElement
The first element.
to ErElement
The second element.
fromCardinality ErCardinality
How many instances of from an instance of to relates to.
toCardinality ErCardinality
How many instances of to an instance of from relates to.
label DiagramText?
The text of the relationship, from the point of view of from, or null.

Returns

ErRelationship The relationship.

AddSubgraph(string, DiagramText?)

ErDiagram.cs

Adds a top-level subgraph.

public ErSubgraph AddSubgraph(string id, DiagramText? title = null)

Parameters

id string
The identifier.
title DiagramText?
The title, or null to show the identifier.

Returns

ErSubgraph The subgraph.

EnumerateSubgraphs()

ErDiagram.cs

Enumerates the subgraphs and their nested subgraphs, depth first.

public IEnumerable<ErSubgraph> EnumerateSubgraphs()

Returns

IEnumerable<ErSubgraph> The subgraphs.

Find(string)

ErDiagram.cs

Finds an entity or a subgraph by identifier. A subgraph hides an entity of the same name.

public ErElement? Find(string id)

Parameters

id string
The identifier.

Returns

ErElement? The element, or null when there is none.