Skip to main content

How to call a code of my assembly from CodeAction

The code of CodeActions is just an ordinary C# code, any methods can be called or any types used from your assembly. It is required to call the following method from the WorkflowRuntime object to register your own types from the assembly,

_runtime.RegisterAssemblyForCodeActions(
Assembly.GetAssembly(typeof(some type from your assembly)));

Below is described how to make use of: RegisterAssemblyForCodeActions for implementing code from the backend.

  1. First at all, a new class should be created:

    public class MyClass
    {
    private int Count { get; set; }

    public MyClass()
    {
    Count = 34;
    }

    public void IncreaseCount()
    {
    Count++;
    }
    }
  2. This class can be registered like this:

    workflowServer.WorkflowRuntime.RegisterAssemblyForCodeActions(
    Assembly.GetAssembly(typeof(MyClass)));
  3. Then, the new class can be implemented in visual designer by creating code actions as is shown below:

    Code Actions 1

  4. After clicking on button 'Compile', the following notification should appear:

    Code Actions 2

  5. Once the code is executed, in debugging mode might be used breakpoints:

    Add breakpoints

Afterward, all namespaces from your assembly will be added to new CodeActions.