Table of Contents

Class NodeDefinition

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

Immutable definition of a node's identity and structure. Contains all properties that define "what" a node is, not "where" it is or its runtime state.

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

Remarks

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

var renamed = definition with { Label = "New Label" };

Properties

AllowedResizeHandles

Specifies which resize handles should be displayed when this node is selected.

public ResizeHandleMode AllowedResizeHandles { get; init; }

Property Value

ResizeHandleMode

Remarks

Default is All (all 8 handles). For nodes with non-rectangular geometry (cylinders, circles, etc.), set this to only show handles that make visual sense.

Data

Custom user data associated with the node. Consider using immutable types for full immutability.

public object? Data { get; init; }

Property Value

object

GroupPadding

Custom padding around group children when calculating group bounds. Only applies when IsGroup is true. If null, uses the default from settings.

public double? GroupPadding { get; init; }

Property Value

double?

Id

Unique identifier for the node. Required and immutable.

public required string Id { get; init; }

Property Value

string

Inputs

Input ports for this node (immutable list).

public ImmutableList<PortDefinition> Inputs { get; init; }

Property Value

ImmutableList<PortDefinition>

IsConnectable

Whether this node can have new connections. Default is true.

public bool IsConnectable { get; init; }

Property Value

bool

IsDeletable

Whether this node can be deleted. Default is true.

public bool IsDeletable { get; init; }

Property Value

bool

IsDraggable

Whether this node can be dragged. Default is true.

public bool IsDraggable { get; init; }

Property Value

bool

IsGroup

Whether this node is a group container.

public bool IsGroup { get; init; }

Property Value

bool

IsResizable

Whether this node can be resized. Default is true.

public bool IsResizable { get; init; }

Property Value

bool

IsSelectable

Whether this node can be selected. Default is true.

public bool IsSelectable { get; init; }

Property Value

bool

Label

Optional display label for the node.

public string? Label { get; init; }

Property Value

string

Outputs

Output ports for this node (immutable list).

public ImmutableList<PortDefinition> Outputs { get; init; }

Property Value

ImmutableList<PortDefinition>

ParentGroupId

The ID of the parent group node, if this node is part of a group.

public string? ParentGroupId { get; init; }

Property Value

string

Type

The type/category of the node (e.g., "process", "decision", "input"). Used for rendering and validation.

public string Type { get; init; }

Property Value

string

Methods

AddInput(PortDefinition)

Adds an input port to the definition.

public NodeDefinition AddInput(PortDefinition port)

Parameters

port PortDefinition

Returns

NodeDefinition

AddOutput(PortDefinition)

Adds an output port to the definition.

public NodeDefinition AddOutput(PortDefinition port)

Parameters

port PortDefinition

Returns

NodeDefinition

WithPorts(IEnumerable<PortDefinition>?, IEnumerable<PortDefinition>?)

Creates a NodeDefinition with the specified ports using a builder pattern.

public NodeDefinition WithPorts(IEnumerable<PortDefinition>? inputs = null, IEnumerable<PortDefinition>? outputs = null)

Parameters

inputs IEnumerable<PortDefinition>
outputs IEnumerable<PortDefinition>

Returns

NodeDefinition