menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class UmlSequenceFragmentCondition - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class UmlSequenceFragmentCondition

    Represents a condition within a UML sequence diagram fragment that defines guard expressions and controls the execution of specific messages within the fragment's scope.

    Inheritance
    System.Object
    UmlSequenceFragmentCondition
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class UmlSequenceFragmentCondition : Object
    Remarks

    Fragment conditions serve as guard expressions that determine when and how messages within a fragment should execute. Each condition contains:

    • Content - The guard expression or condition text (e.g., "x > 0", "user.IsAuthenticated")
    • MessageIds - The specific messages that are governed by this condition
    • Nested Fragments - Optional sub-fragments that can be contained within this condition

    Conditions are essential for different fragment types:

    • Loop fragments - Condition specifies the loop continuation criteria
    • Optional fragments - Condition determines if the messages execute
    • Alternative fragments - Multiple conditions provide mutually exclusive execution paths
    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

    UmlSequenceFragmentCondition()

    Initializes a new instance of the UmlSequenceFragmentCondition class.

    Declaration
    public UmlSequenceFragmentCondition()

    Properties

    Content

    Gets or sets the descriptive content of the condition. This typically represents a guard expression, logical condition, or contextual label that defines when the associated messages should execute.

    Declaration
    public string Content { get; set; }
    Property Value
    Type Description
    System.String

    A System.String representing the condition's guard expression or descriptive text. This content is displayed in the fragment's condition compartment and determines the execution logic for the messages governed by this condition. The default value is an empty string.

    Remarks

    The content serves as both a visual label and logical expression that controls fragment behavior:

    • Guard expressions - Boolean conditions like "x > 0", "user.IsAuthenticated"
    • Loop conditions - Iteration criteria like "i < count", "hasMoreData"
    • Alternative labels - Descriptive text like "Valid Input", "Error Case"
    • Contextual descriptions - Explanatory text for complex scenarios
    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"}
                        }
                    }
                }
            }
            };
        }
    }

    Fragments

    Gets or sets the collection of nested fragments within this condition. Nested fragments allow for hierarchical or alternative flow representations within a condition block.

    Declaration
    public List<UmlSequenceFragment> Fragments { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<UmlSequenceFragment>

    A System.Collections.Generic.List<> of UmlSequenceFragment instances that represent sub-fragments scoped within this condition. These nested fragments help define complex interaction structures like loops, alternatives, and optional within a broader condition. The list cannot be set to null, but can be empty. The default value is an empty list.

    Remarks

    Nested fragments enable complex hierarchical structures in UML sequence diagrams:

    • Nested loops - A loop fragment within an alternative condition
    • Conditional alternatives - Alternative fragments within an optional block
    • Parallel processing - Parallel fragments within a loop or condition
    • Exception handling - Break fragments nested within try-catch scenarios
    Each nested fragment operates within the scope of its parent condition and inherits the parent's execution context.
    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"},
                            Fragments = new List<UmlSequenceFragment>()
                            {
                                new UmlSequenceFragment() { ID = "frag2", FragmentType = UmlSequenceFragmentType.Loop}
                            }
                        }
                    }
                }
            }
            };
        }
    }

    MessageIds

    Gets or sets the collection of sequence message IDs that belong to this condition. These are references to messages that are governed by this condition's execution logic.

    Declaration
    public List<string> MessageIds { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    A System.Collections.Generic.List<> of System.String values, each representing the unique identifier of a message included in this condition. These message IDs must correspond to those defined in the Messages collection. The default value is an empty list.

    Remarks

    The MessageIds collection defines which messages are controlled by this condition:

    • Optional fragments - Messages execute only if the condition is true
    • Loop fragments - Messages repeat while the condition remains true
    • Alternative fragments - Messages in this condition execute when this path is chosen
    The order of message IDs in the list determines their execution sequence within the condition.
    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"}
                        }
                    }
                }
            };
        }
    }
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved