Class FunctionInvoker<TReturn>
OptimaJet.Workflow.Core.CodeActions.FunctionInvoker<TReturn>
Stores asynchronous workflow functions by transition name and invokes them for process instances.
Namespace: OptimaJet.Workflow.Core.CodeActions
public abstract class FunctionInvoker<TReturn>Type Hierarchy
- FunctionInvoker<TReturn> Current type
Constructors
public FunctionInvoker() #Initializes a new instance of the FunctionInvoker<TReturn> type.
Properties
protected abstract FunctionInvoker<TReturn>.InvokerNotFoundReactionType InvokerNotFoundReaction { get; } #Gets the behavior applied by the FunctionInvoker<TReturn>.InvokeAsync(TransitionDefinition, ProcessInstance) methods when no function is registered for the requested transition.
public abstract string FunctionName { get; } #Gets the label included in compilation-error and missing-function messages.
Methods
public void RegisterFunctions(IDictionary<string, Func<ProcessInstance, Task<TReturn>>> functions) #Registers compiled transition functions by transition name.
Parameters
Name
Type
Description
functionsIDictionary<String, ProcessInstance, Task<TReturn>>A map from transition names to functions that evaluate a ProcessInstance.
Exceptions
Type
Description
ArgumentExceptionThrown when a function is already registered for one of the supplied transition names.
ArgumentNullExceptionThrown when one of the supplied transition names is null.
public Task<TReturn> InvokeAsync(TransitionDefinition transitionDefinition, ProcessInstance processInstance) #Invokes the compiled function identified by
transitionDefinition for the supplied processInstance.Parameters
Name
Type
Description
transitionDefinitionTransitionDefinitionThe TransitionDefinition whose TransitionDefinition.Name is used for lookup.
Returns
Type
Description
Task<TReturn>The value returned by the selected function, or default for
TReturn when no function is registered and the derived invoker uses FunctionInvoker<TReturn>.InvokerNotFoundReactionType.ReturnDefault.Exceptions
Type
Description
ExceptionThrown when no function is registered for the transition and the derived invoker does not return a default value for missing functions. Exceptions raised by a registered function are propagated.
ArgumentNullExceptionThrown when TransitionDefinition.Name is null.
public Task<TReturn> InvokeAsync(string transitionName, ProcessInstance processInstance) #Invokes the compiled function identified by
transitionName for the supplied processInstance.Parameters
Name
Type
Description
transitionNameStringThe transition name used to locate the compiled function.
Returns
Type
Description
Task<TReturn>The value returned by the selected function, or default for
TReturn when no function is registered and FunctionInvoker<TReturn>.InvokerNotFoundReaction is FunctionInvoker<TReturn>.InvokerNotFoundReactionType.ReturnDefault.Exceptions
Type
Description
ExceptionThrown when no function is registered for
transitionName and FunctionInvoker<TReturn>.InvokerNotFoundReaction is not FunctionInvoker<TReturn>.InvokerNotFoundReactionType.ReturnDefault. Exceptions raised by a registered function are propagated.ArgumentNullExceptionThrown when
transitionName is null.Remarks
If the transition is not registered and FunctionInvoker<TReturn>.InvokerNotFoundReaction is FunctionInvoker<TReturn>.InvokerNotFoundReactionType.ReturnDefault, default is returned. Otherwise Exception is thrown.
Nested Types
protected enum FunctionInvoker<TReturn>.InvokerNotFoundReactionType #Defines the behavior when a requested transition function is missing.
View FunctionInvoker<TReturn>.InvokerNotFoundReactionType