Table of Contents

Class PortDefinition

Namespace
FlowGraph.Core.Models
Assembly
FlowGraph.Core.dll

Immutable definition of a port on a node. Ports define the interface for data flow between nodes.

public sealed record PortDefinition : IEquatable<PortDefinition>
Inheritance
PortDefinition
Implements
Inherited Members

Remarks

This is a sealed record for value equality and immutability. Use with expressions to create modified copies.

Properties

Id

Unique identifier for the port within its node.

public required string Id { get; init; }

Property Value

string

IsRequired

Whether this port is required to have at least one connection.

public bool IsRequired { get; init; }

Property Value

bool

Label

Optional display label for the port.

public string? Label { get; init; }

Property Value

string

MaxConnections

Maximum number of connections allowed to this port. Null means unlimited connections.

public int? MaxConnections { get; init; }

Property Value

int?

Position

The position of the port on the node. If null, defaults to Left for inputs and Right for outputs.

public PortPosition? Position { get; init; }

Property Value

PortPosition?

Tooltip

Optional tooltip text shown when hovering over the port.

public string? Tooltip { get; init; }

Property Value

string

Remarks

Provides additional context about the port's purpose, expected data type, or usage guidelines. Rendered as a native tooltip on hover.

Type

The data type that this port accepts or produces. Used for connection validation.

public required string Type { get; init; }

Property Value

string

Methods

FromPort(Port)

Creates a PortDefinition from a legacy Port record.

public static PortDefinition FromPort(Port port)

Parameters

port Port

Returns

PortDefinition

ToPort()

Converts to a legacy Port record for backward compatibility.

public Port ToPort()

Returns

Port