Skip to main content

General

C# Scripting

Extend edge capabilities with full .NET code.

For complex logic that the Rule Engine cannot handle, you can write standard C# classes. These are compiled and executed at the Edge.

The FunctionBaseActor

Your script must inherit from FunctionBaseActor.

public class MyCustomLogic : FunctionBaseActor
{
    public override async ValueTask Handle(Tag data)
    {
        // Your logic here
        if (data.Name == "Temperature" && data.Value > 100)
        {
             await Mqtt.PublishAsync("alerts/critical", new { Msg = "Too Hot!" });
        }
    }
}

Security

The PluginManager sandboxes your code:

  • Auto-Dispose: All IDisposable resources are cleaned up automatically.
  • Try/Catch Injection: Unhandled exceptions are caught to prevent crashing the actor system.
  • Blocked Namespaces: File I/O and Network I/O are restricted to safe APIs provided by the SDK.