Class RelationShip
Represents a UML relationship connector between classifiers.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.Diagram.dll
Syntax
public class RelationShip : ConnectorShape, IDiagramObject, ICloneable
Remarks
Defines the relationship type (e.g., association, inheritance), directionality, and optional multiplicity annotations at both ends.
Examples
Connector connector = new Connector()
{
ID = "rel1",
SourceID = "class1",
TargetID = "class2",
Shape = new RelationShip()
{
RelationshipShape = Relationship.Aggregation,
AssociationType = AssociationFlow.BiDirectional,
Multiplicity = new ClassifierMultiplicity()
{
Source = new MultiplicityLabel { LowerBounds = "1", UpperBounds = "1" },
Target = new MultiplicityLabel { LowerBounds = "0", UpperBounds = "*" }
}
}
};
Constructors
RelationShip()
Initializes a new instance of RelationShip.
Declaration
public RelationShip()
RelationShip(RelationShip)
Initializes a new instance of RelationShip copied from src.
Declaration
public RelationShip(RelationShip src)
Parameters
| Type | Name | Description |
|---|---|---|
| RelationShip | src |
Properties
AssociationType
Gets or sets the directionality of an association relationship.
Declaration
[JsonPropertyName("associationType")]
public AssociationFlow? AssociationType { get; set; }
Property Value
| Type | Description |
|---|---|
| AssociationFlow? | A AssociationFlow representing the association direction. |
Remarks
Applicable only when RelationshipShape is Association.
It controls whether the association is unidirectional or bidirectional.
Examples
This example demonstrates creating a bidirectional association:
connectors.Add(new Connector()
{
SourcePoint = new DiagramPoint() { X = 150, Y = 250 },
TargetPoint = new DiagramPoint() { X = 350, Y = 250 },
Type = ConnectorSegmentType.Straight,
Shape = new RelationShip()
{
RelationshipShape = Relationship.Association,
AssociationType = AssociationFlow.BiDirectional
}
});
Multiplicity
Gets or sets the multiplicity configuration for the relationship.
Declaration
[JsonPropertyName("multiplicity")]
public ClassifierMultiplicity? Multiplicity { get; set; }
Property Value
| Type | Description |
|---|---|
| ClassifierMultiplicity | A ClassifierMultiplicity representing source and target cardinality.
When |
Remarks
Defines the cardinality at both source and target ends using labels such as "1", "0..*", etc. If null, no multiplicity labels are displayed.
Examples
This example demonstrates applying multiplicity to a connector:
DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
connectors.Add(new Connector()
{
ID = "connector3",
SourcePoint = new DiagramPoint() { X = 200, Y = 300 },
TargetPoint = new DiagramPoint() { X = 400, Y = 300 },
Type = ConnectorSegmentType.Straight,
Shape = new RelationShip()
{
RelationshipShape = Relationship.Dependency,
Multiplicity = new ClassifierMultiplicity()
{
Source = new MultiplicityLabel() { LowerBounds = "1", UpperBounds = "*" },
Target = new MultiplicityLabel() { LowerBounds = "0", UpperBounds = "1" }
}
}
});
RelationshipShape
Gets or sets the UML relationship type.
Declaration
[JsonPropertyName("relationshipShape")]
public Relationship RelationshipShape { get; set; }
Property Value
| Type | Description |
|---|---|
| Relationship | A Relationship representing the type of UML relationship. The default value is Aggregation. |
Remarks
Determines the connectors visual style and associated decorators, such as:
Association(line)Aggregation(hollow diamond)Composition(filled diamond)Inheritance(triangle arrow)Dependency(dashed arrow)
Examples
This example demonstrates creating a connector with an aggregation relationship:
connectors.Add(new Connector()
{
SourcePoint = new DiagramPoint() { X = 100, Y = 200 },
TargetPoint = new DiagramPoint() { X = 300, Y = 200 },
Type = ConnectorSegmentType.Straight,
Shape = new RelationShip()
{
RelationshipShape = Relationship.Aggregation
}
});
Methods
Clone()
Creates a new object that is a copy of the current RelationShip.
Declaration
public override object Clone()
Returns
| Type |
|---|
| object |