C# Script
Compiles a complete attributed C# Node into a V2 Workflow and executes its custom method.
Revision History
0.0.0.1 - Initial release.
0.0.0.2 - Added validation for unsupported Connection and runtime-owned parameters.
0.0.0.3 - Improved compatibility when publishing C# Script Nodes.
Setup Notes
Use a built-in template or provide a complete C# source file in Script.Content. The source must include a namespace, exactly one public type decorated with FgNode, and exactly one method decorated with FgMethod.Invoke.
Add optional NuGet dependencies to Script.NuGetPackages. Enter one dependency per line using an exact PackageId@version, e.g. Microsoft.Data.SqlClient@6.1.1. Version ranges and floating versions are not supported.
The compiler automatically imports these common namespaces:
SystemSystem.Collections.GenericSystem.IOSystem.LinqSystem.Net.HttpSystem.ThreadingSystem.Threading.Tasks
Add ordinary using directives for Flowgear SDK and package namespaces used by Script.Content.
You can run this Node on Flowgear Cloud and Run Anywhere Clusters.
Methods
This Node exposes one method whose runtime inputs and returns are derived from the invoke method in Script.Content.
Execute
Compiles and executes the custom C# method defined by Script.
| Parameter | Type | Description |
|---|---|---|
Script |
Script | The C# source and its compile-time dependencies. This configuration is not passed to the embedded invoke method at runtime. |
Script.NuGetPackages |
String | Optional NuGet dependencies, with one exact PackageId@version per line. |
Script.Content |
String | The complete C# source containing one attributed V2 Node class and invoke method. |
After Flowgear prepares the script, the method exposes each parameter decorated with FgParameter in the embedded invoke method. Parameter names and types therefore depend on Script.Content.
The method also exposes the returns declared by the embedded invoke method. Return names and types therefore depend on Script.Content.
Usage Notes
- Use the
Basic scalar methodtemplate for scalar inputs and a single scalar return. - Use the
Object methodtemplate for a typed request and multiple returns declared throughFgReturnContainerandFgReturn. - Use the
Large collection exampletemplate for lazily processedIAsyncEnumerable<T>inputs and returns. - An embedded invoke method can include an optional
CancellationToken. Flowgear supplies it at runtime and does not expose it as a Workflow input. - NuGet packages are resolved for debug and published Workflow compilation. Preview shape discovery does not download packages.
- Package and Flowgear namespaces still require explicit
usingdirectives even when their assemblies are referenced. - Prefer a purpose-built Node when it expresses the same behavior clearly. Use C# Script for custom logic that would otherwise require an unsuitable or overly complex sequence of Nodes.
Known Issues
- C# Script is supported only by the V2 compiler and runtime.
- Embedded invoke methods cannot use
FgConnection,FgState,FgLogger, orFgStepparameters. - Types exposed in the embedded method signature must be defined in
Script.Contentor available from the standard .NET and Flowgear references. Package-defined types can be used internally but cannot be exposed as inputs or returns.