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.
-
First, a new class should be created:
public class MyClass
{
private int Count { get; set; }
public MyClass()
{
Count = 34;
}
public void IncreaseCount()
{
Count++;
}
} -
This class can be registered like this:
workflowServer.WorkflowRuntime.RegisterAssemblyForCodeActions(
Assembly.GetAssembly(typeof(MyClass))); -
Then, the new class can be implemented in visual designer by creating code actions as is shown below:
-
After clicking on button 'Compile', the following notification should appear:
-
Once the code is executed, in debugging mode might be used breakpoints:
Afterward, all namespaces from your assembly will be added to new CodeActions.