C# Script v2
Provides support for custom C# Script to be executed within a Workflow.
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, for example, 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 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.
See Embedded C# Scripts for more information on using this Node.
Usage Notes
The script is trusted code and runs inside the Runtime process. Review the source and NuGet dependencies before publishing the Workflow.
Preview validates the script's shape, but does not acquire NuGet packages or compile the executable Method body. Debug or publish the Workflow to validate those parts of the script.
Use script-defined, standard .NET, or Flowgear contract types in the public Method signature. Package-defined types can be used only inside the Method body.
An optional CancellationToken parameter is supplied by the Runtime and is not exposed as a Workflow input. Connection types and parameters decorated with FgState, FgLogger, or FgStep are not supported.