Programmatic schema builder
This functionality is available in Workflow Engine 13.3.0 and later.
With the Workflow Engine Builder, you can create workflow schemas programmatically without using a designer interface. To work with the
Builder, you need to initialize
the IProcessDefinitionBuilder
interface:
IProcessDefinitionBuilder processDefinitionBuilder = ProcessDefinitionBuilder.Create("SchemeName");
IProcessDefinitionBuilder
provides the necessary methods for creating workflow elements. After creating elements, you can set additional
options. For example, to create a new activity, you can call
the CreateActivity
method with a name, then set the state
, mark it as
initial
, and position it on the schema using coordinates.
processDefinitionBuilder
.CreateActivity("InitialActivity")
.State("Initial")
.Initial()
.EnableSetState()
.EnableAutoSchemeUpdate()
.SetX(320).SetY(220)
.Ref(out ActivityDefinition activity1)
.CreateActivity("FinalActivity")
.State("Final")
.Final()
.EnableSetState()
.EnableAutoSchemeUpdate()
.SetX(520).SetY(220)
.Ref(out ActivityDefinition activity2);
The Ref
method
allows you to obtain a reference to the created definition for further use.
Similarly, you can create commands and transitions using
the CreateCommand
and CreateTransition
methods, respectively.
processDefinitionBuilder
.CreateCommand("Go")
.Ref(out CommandDefinition goCommand)
.CreateTransition("TransitionName", activity1, activity2)
.Direct();
For a complete list of methods, refer to the API Reference.