Scheme generation

We have already mentioned several times that in case Workflow Engine does not find an active scheme in the WorkflowProcessInstance table (object), scheme generation is started. Let's discuss what a scheme generator is and what opportunities for enhancing Workflow Engine's operation it provides. In fact, the IWorkflowGenerator interface is defined by a single method.

The TSchemeMedium type specifies the type of scheme storing. By default, this is the XElement type; in other words, the scheme is stored in XML. The Generate method accepts three parameters:

schemeCode - scheme name (code);

schemeId - scheme id, with which it will be stored in the WorkflowProcessScheme table (object);

parameters - a dictionary of parameters that may be used to generate schemes. The parameter dictionary with which the CreateInstance is called is conveyed to the method. Only simple types such as String, Bool, Guid, Int, etc. and IEnumerable, where T is a simple type, may so far be used in the dictionary values.

Thus, parameters which we convey to the SchemeCreationParameters dictionary will be conveyed to the scheme generator and used for scheme generation.

Generation parameters and scheme updates

In case generation parameters are conveyed to the generator during scheme generation, a scheme will be identified by the scheme name (code) + parameters combination. Thus, two schemes with the same name but different parameters are considered different schemes. In case a process scheme is generated with the use of parameters, generation parameters should be conveyed again during process scheme update. They may be conveyed in two ways:

In case scheme generation parameters which the scheme was generated with depend on the process (for example, they represent fields of an object that the process uses), IsObsolete should not necessarily be set. Other processes will probably use this scheme, and it won't be obsolete for them. In this case, it is more reasonable to set the IsDeterminingParametersChanged attribute to the entry in the WorkflowProcessInstance table. In case a scheme with the conveyed parameters already exists, the update or rebind of the scheme for a certain process takes place.