ActionGraph
public class ActionGraph Represents an async method as a directed graph. Control will enter through an "event" node, which can route signals through a network of other nodes that perform actions. Use NodeLibrary) to create a completely blank graph, or NodeLibrary) to create a graph that handles an event matching the signature of a particular delegate.
Properties
| Name | Type | Description |
|---|---|---|
TargetDefinition | InputDefinition | The definition of the graph input that represents the target of the graph. |
TargetOutput | Output | The output of the graph's entry node that represents the target of the graph. |
SourceLocation | ISourceLocation | Identifies where this instance was deserialized from. |
Title | String | |
Description | String | |
Category | String | |
Icon | String | |
Tags | String[] | |
Guid | Guid | |
NodeLibrary virtual | NodeLibrary | Library of node definitions available for use by this action graph. |
Nodes | IReadOnlyDictionary<Int32, Node> | Set of nodes added to this action graph. |
Links | IReadOnlySet<Link> | Set of links added between nodes in this action graph. |
Variables | IReadOnlyDictionary<String, Variable> | Set of variables added to this action graph. |
UserData | JsonObject | Arbitrary named values stored in this action graph, which will be included during serialization. Values must be serializable to JSON. |
InputNode | Node | Entry point of the graph. |
PrimaryOutputNode | Node | Primary output of the graph. |
OutputNodes | IEnumerable<Node> | Nodes that emit return values or output signals from this graph to the caller. |
Inputs | IReadOnlyDictionary<String, InputDefinition> | |
Outputs | IReadOnlyDictionary<String, OutputDefinition> | |
DisplayInfo | DisplayInfo | |
StackTraceIdentifier virtual | String | |
Kind | NodeKind | |
SerializationOptions static | SerializationOptions | |
ChangeId | Int32 | Increments each time this graph re-validates after a change. |
Messages | IReadOnlyCollection<ValidationMessage> |
Methods
virtual Node AddNode(NodeDefinition definition) Add a new node to this action graph, with the given .
definition — Definition describing the properties, inputs and outputs of a node. Node AddNode(NodeDefinition definition, Node parent) Add a new node to this action graph, with the given .
definition — Definition describing the properties, inputs and outputs of a node. parent — Optional parent node to create a child for. Void RemoveNode(Node node) Remove a node from this action graph. Any links into or out of the node will also be removed.
node — Node to remove. Variable AddVariable(String name, Type type, Object defaultValue = null) Void RemoveVariable(Variable variable) Link SetLink(Input target, ILinkSource source) Link SetLink(Input target, ILinkSource source, Int32 index) Link InsertLink(Input target, ILinkSource source, Int32 index) IReadOnlyList<Link> SetLinks(Input target, IEnumerable<ILinkSource> sources) Void RemoveLink(Link link) static ActionGraph CreateEmpty(NodeLibrary nodeLibrary) Creates a completely blank action graph. This won't be invokable until an event node is added.
nodeLibrary — Source of node definitions for the new action graph. static IActionGraphDelegate CreateDelegate(NodeLibrary nodeLibrary, Type delegateType) Creates an action graph with an event node matching the signature of .
nodeLibrary — Source of node definitions for the new action graph. delegateType — Delegate type to match the signature of. static ActionGraphDelegate<T> CreateDelegate(NodeLibrary nodeLibrary) Creates an action graph with an event node matching the signature of delegate type .
nodeLibrary — Source of node definitions for the new action graph. Void AddRequiredNodes() Void RemoveUnusedChildNodes() LambdaExpression BuildExpression() Builds a LambdaExpression that implements this graph.
IReadOnlyDictionary<String, Object> Evaluate(IReadOnlyDictionary<String, Object> inputs = null) IReadOnlyDictionary<String, Object>> InvokeAsync(IReadOnlyDictionary<String, Object> inputs = null, IReadOnlyDictionary<String, OutputDelegate> outputs = null) ActionGraphDelegate<T> CreateDelegate(IReadOnlyDictionary<String, Object> defaults = null) IActionGraphDelegate CreateDelegate(Type delegateType, IReadOnlyDictionary<String, Object> defaults = null) IEnumerable<IActionGraphDelegate> GetDelegates() Gets all known IActionGraphDelegates created from this graph.
Void SetParameters(IReadOnlyCollection<InputDefinition> inputs, IReadOnlyCollection<OutputDefinition> outputs) Void SetParameters(NodeBinding binding) String Serialize(IEnumerable<Node> nodes, JsonSerializerOptions options) JsonNode SerializeToNode(IEnumerable<Node> nodes, JsonSerializerOptions options) InsertResult DeserializeInsert(String json, JsonSerializerOptions options) InsertResult DeserializeInsert(JsonNode json, JsonSerializerOptions options) static SerializationOptionsScope PushSerializationOptions(SerializationOptions options) static SerializationOptionsScope PushTarget(InputDefinition value) static SerializationOptionsScope PushCache(IActionGraphCache value, Boolean writeReferences) static SerializationOptionsScope PushSourceLocation(ISourceLocation value) static SerializationOptionsScope PushGuidMap(IReadOnlyDictionary<Guid, Guid> value) static SerializationOptionsScope PushWriteCacheReferences(Boolean value) static SerializationOptionsScope PushMakeGuidsUnique(Boolean value) Void Deserialize(String json, Type delegateType, JsonSerializerOptions options = null) Restore a previously serialized graph from JSON in this instance.
json — Serialized action graph. delegateType — Optional delegate type, must match the one used when serializing. options — Optional serializer options. Boolean CanCreateSubGraph(IEnumerable<Node> nodes) CreateSubGraphResult>? CreateSubGraphAsync(IEnumerable<Node> nodes, JsonSerializerOptions jsonOptions, CreateSubGraphNodeDelegate createSubGraphNode) Void Validate(Boolean force = False) Void ClearChanges() Don't increment ChangeId during next validation.
Fields
| Name | Type | Description |
|---|---|---|
CurrentFormatVersion static | Int32 |
Facepunch.ActionGraphs Namespace: Facepunch.ActionGraphs Full Name: Facepunch.ActionGraphs.ActionGraph