Class UmlSequenceDiagramModel
Represents a data model for creating and managing UML sequence diagrams. This model encapsulates the structural elements of a sequence diagram including actors, messages, lifelines, and their interactions over time.
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class UmlSequenceDiagramModel : DiagramModel
Remarks
A sequence diagram shows how objects interact with each other in a particular scenario of a use case. This model provides the foundation for rendering sequence diagrams by maintaining the relationships between participants and the chronological order of message exchanges.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
},
Messages = new List<UmlSequenceMessage>()
{
new UmlSequenceMessage()
{
ID = "MSG1",
Content = "User sends request",
FromParticipantID = "User",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG2",
Content = "Processing",
FromParticipantID = "Server",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG3",
Content = "Server sends response",
FromParticipantID = "Server",
ToParticipantID = "User"
}
},
Fragments = new List<UmlSequenceFragment>()
{
new UmlSequenceFragment()
{
ID = "frag1",
FragmentType = UmlSequenceFragmentType.Optional,
Conditions = new List<UmlSequenceFragmentCondition>()
{
new UmlSequenceFragmentCondition()
{
Content = "Interactions",
MessageIds = new List<string>(){"MSG1", "MSG2", "MSG3"}
}
}
}
}
};
}
}
Constructors
UmlSequenceDiagramModel()
Declaration
public UmlSequenceDiagramModel()
Properties
Fragments
Gets or sets the collection of fragments in the sequence diagram. Fragments represent logical groupings of messages that define control flow structures such as loops, conditionals, alternatives, and optional interactions.
Declaration
public List<UmlSequenceFragment> Fragments { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<UmlSequenceFragment> | A list of UmlSequenceFragment objects that defines grouped message interactions and their conditions, such as optional, loop, or alternative flows. Each fragment can contain multiple conditions and specify which messages are included within its scope. The default value is an empty list. |
Remarks
Fragments are displayed as rectangular boxes that span across participant lifelines, enclosing the messages they contain. Fragment types include Alt (alternative), Opt (optional), and Loop. The fragment's condition determines when the enclosed messages should be executed.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
},
Messages = new List<UmlSequenceMessage>()
{
new UmlSequenceMessage()
{
ID = "MSG1",
Content = "User sends request",
FromParticipantID = "User",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG2",
Content = "Processing",
FromParticipantID = "Server",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG3",
Content = "Server sends response",
FromParticipantID = "Server",
ToParticipantID = "User"
}
},
Fragments = new List<UmlSequenceFragment>()
{
new UmlSequenceFragment()
{
ID = "frag1",
FragmentType = UmlSequenceFragmentType.Optional,
Conditions = new List<UmlSequenceFragmentCondition>()
{
new UmlSequenceFragmentCondition()
{
Content = "Interactions",
MessageIds = new List<string>(){"MSG1", "MSG2", "MSG3"}
}
}
}
}
};
}
}
Messages
Gets or sets the collection of messages between participants in the sequence diagram. Messages represent the communications, method calls, or interactions that occur between participants in chronological order during the sequence execution.
Declaration
public List<UmlSequenceMessage> Messages { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<UmlSequenceMessage> | A list of UmlSequenceMessage objects that defines the interactions between participants in the sequence diagram. Each message specifies the sender, receiver, content, and timing of the communication. Messages can represent synchronous calls, asynchronous calls, return messages, or self-calls. The default value is an empty list. |
Remarks
Messages are displayed as horizontal arrows between participant lifelines. The order of messages in this collection determines their vertical positioning and execution sequence in the rendered diagram. Message IDs are used to link with activation boxes to show when participants are active.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
},
Messages = new List<UmlSequenceMessage>()
{
new UmlSequenceMessage()
{
ID = "MSG1",
Content = "User sends request",
FromParticipantID = "User",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG2",
Content = "Processing",
FromParticipantID = "Server",
ToParticipantID = "Server"
},
new UmlSequenceMessage()
{
ID = "MSG3",
Content = "Server sends response",
FromParticipantID = "Server",
ToParticipantID = "User"
}
}
};
}
}
Participants
Gets or sets the collection of participants in the sequence diagram. Participants represent the entities (actors, objects, or systems) that interact with each other through message exchanges in the sequence diagram.
Declaration
public List<UmlSequenceParticipant> Participants { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<UmlSequenceParticipant> | A list of UmlSequenceParticipant objects that define the participants in the sequence diagram. Each participant can be configured as an actor or object with associated activation boxes to show when they are active during interactions. The default value is an empty list. |
Remarks
Participants are displayed as vertical lifelines in the sequence diagram. The order of participants in this collection determines their left-to-right positioning in the rendered diagram.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
Participants = new List<UmlSequenceParticipant>()
{
new UmlSequenceParticipant()
{
ID = "User",
Content= "User",
ShowDestructionMarker= true,
IsActor= true,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act1", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
},
new UmlSequenceParticipant()
{
ID = "Server",
Content= "Server",
ShowDestructionMarker= true,
IsActor= false,
ActivationBoxes= new List<UmlSequenceActivationBox>()
{
new UmlSequenceActivationBox() { ID = "act2", StartMessageID= "MSG1", EndMessageID= "MSG3" }
}
}
}
};
}
}
SpaceBetweenParticipants
Gets or sets the horizontal space between participants in the sequence diagram. This property controls the distance between participant lifelines, affecting the overall width and readability of the diagram.
Declaration
public double SpaceBetweenParticipants { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double value representing the horizontal spacing between participant lifelines in pixels. Larger values create more space between participants, which can improve readability for diagrams with long message labels or many participants. The default value is 100. |
Remarks
This spacing affects the positioning of participant headers and their corresponding lifelines. Adequate spacing ensures that message arrows and labels don't overlap and remain clearly visible. Consider increasing this value for complex diagrams with lengthy message content.
Examples
<SfDiagramComponent Height="600px" Model="@umlModel">
</SfDiagramComponent>
@code
{
UmlSequenceDiagramModel umlModel;
protected override void OnInitialized()
{
umlModel = new UmlSequenceDiagramModel()
{
SpaceBetweenParticipants = 150
};
}
}