Assembly: OptimaJet.Workflow.Core

Class ParameterDefinition

OptimaJet.Workflow.Core.Model.ParameterDefinition

Defines a process parameter declared in ProcessDefinition.Parameters.

public class ParameterDefinition : BaseDefinition

Type Hierarchy

Properties

[JsonConverter(typeof(NewtonsoftStringTypeConverter))] [JsonConverter(typeof(SystemTextStringTypeConverter))] public virtual Type Type { get; set; } #
Gets or sets the CLR Type used for process parameter values.
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(SystemStringEnumConverter<ParameterPurpose>))] public virtual ParameterPurpose Purpose { get; set; } #
Gets or sets the ParameterPurpose that controls how Workflow Engine manages and stores the process parameter.
public virtual string InitialValue { get; set; } #
Gets or sets the stored representation of the process parameter's initial value. Workflow Engine uses this value when initializing a parameter whose ParameterDefinition.Purpose is ParameterPurpose.Persistence.

Methods

public static ParameterDefinition Create(string name, Type type, ParameterPurpose purpose, string initialValue = null) #
Creates a ParameterDefinition with the specified settings.

Parameters

Name
Type
Description
name
String
The process parameter name.
type
Type
The CLR Type to assign to ParameterDefinition.Type.
purpose
ParameterPurpose
initialValue
String
The stored representation to assign to ParameterDefinition.InitialValue, or null if no initial value is specified.

Returns

Type
Description
ParameterDefinition
A new ParameterDefinition initialized with the specified settings.
public static ParameterDefinitionWithValue Create(ParameterDefinition parameterDefinition, object value) #
Creates a ParameterDefinitionWithValue by associating a value with a parameter definition.

Parameters

Name
Type
Description
parameterDefinition
ParameterDefinition
The ParameterDefinition that describes the parameter.
value
Object
The current value to associate with parameterDefinition.

Returns

Type
Description
ParameterDefinitionWithValue
A ParameterDefinitionWithValue containing the parameter definition and the resulting value.

Exceptions

Type
Description
InvalidParameterValueException
value is not assignable to ParameterDefinition.Type and cannot be converted to that type by Convert.ChangeType(object, Type).

Remarks

Unless ParameterDefinition.Type is UnknownParameterType, the method passes a non-null value that is not assignable to the declared type to Convert.ChangeType(object, Type). When ParameterDefinition.Purpose is ParameterPurpose.System, the returned object reuses parameterDefinition; otherwise, it contains the result of ParameterDefinition.Clone().
public static ParameterDefinitionWithValue CreateFromPersistence(ParameterDefinition parameterDefinition, object value) #
Creates a ParameterDefinitionWithValue for a value loaded from persistence. The returned parameter is marked as unmodified and as already existing in the persistence store.

Parameters

Name
Type
Description
parameterDefinition
ParameterDefinition
The ParameterDefinition that describes the persisted parameter.
value
Object
The value loaded from the persistence store.

Returns

Type
Description
ParameterDefinitionWithValue
A ParameterDefinitionWithValue containing the persisted value and its definition.

Exceptions

Type
Description
InvalidParameterValueException
value is not assignable to ParameterDefinition.Type and cannot be converted to that type by Convert.ChangeType(object, Type).
public ParameterDefinition Clone() #
Creates a copy of the current ParameterDefinition.

Returns

Type
Description
ParameterDefinition
A copy of the current ParameterDefinition.

Exceptions

Type
Description
NullReferenceException

Remarks

The operation uses BaseDefinition.Clone() and therefore performs a shallow copy except for BaseDefinition.DesignerSettings.

Remarks

The system parameter definitions exposed through DefaultDefinitions.DefaultParameters ignore assignments to ParameterDefinition.Type, ParameterDefinition.Purpose, and ParameterDefinition.InitialValue after they are initialized.