Skip to main content
Version: 5.3

General .NET Script instructions

Edition of Scripts

warning

Attention: Within a Docker container, only assemblies compiled for .net Core are supported.

The Script plug-in enables you to define freely with your own C# code transfer objects and triggers.
The configuration of the plug-in is therefore different as well from the other plug-ins : after giving a name and a typ, open the code editor to edit edit the script.

In the Code-Editor

  • You create assembly references.
  • You define input and output parameters.
  • You will already find the basic method that you can program.
  • You have tools for OPC access and writing log messages at your disposal.

The script plug-in allows you to describe complex issues in transfer objects and triggers, for example to perform conversions or trigger complex database queries.

At the top of the menu bar you will find the "Rename script" button (blank sheet with pen) to change the previous name of your script.\

note

Note: In larger application scenarios, the router will be part of an overall strategy, for example with regard to where code that carries business logic is stored. Even in smaller projects, it makes sense to consider wheter, for example, conversions are carried out in the router or via stored procedures in the database.

IDisposable

We recommend integrating the IDisposable interface into the script. This allows you to release memory again, for example when you open ports or start threads in the script. Open ports or running threads are thus closed or terminated at the end of the script. Write the required code in the corresponding method.

public void Dispose()
{
// Your Code
}

The Dispose method is called if:

  • You publish the script after changes.
  • You publish the script without changes.
  • You publish a connection after deleting it.
  • The plug-in is stopped (this always happens when publishing).

Creation of Scripts

  1. Open the plug-in by double-clicking on "Scripts" under the "Plug-ins" menu. You will see a list of the transfer object scripts and trigger scripts created on two tabs.
  2. Select "Add new connection" to create a new script and enter the name and ype. When you create a new script, the scripts opens automatically in the script editor. Double-clicking on an existing enty also opens the script in the script editor.
  3. Programme your script, (see below). Remember to compile and save.

Transfer objects and triggers are then available for connection configuration.