ExecuteSwitch Class
Executes sequences of modules depending on whether the input document contains a specified value.
Namespace
Statiq.Core
Interfaces
Base Types
graph BT Type-->Base0["Module"] click Base0 "/api/Statiq.Common/Module" Base0-->Base1["object"] Type-.->Interface0["IModule"] click Interface0 "/api/Statiq.Common/IModule" Type["ExecuteSwitch"] class Type type-node

Syntax

public class ExecuteSwitch : Module, IModule

Remarks

When creating a Switch module you specify a delegate that will get an object for each document. Cases are then defined via fluent methods that compare the returned object for each document against a supplied object (or array). If the defined object or any of the objects in the array for the case equal the one for the document, the modules in the case are executed. The output of the module is the aggregate output of executing the specified modules against documents matching each case. If a document does not match a defined case, it is executed against the default case (if defined) or output without modification (if no default is defined).

Constructors

Name Summary
ExecuteSwitch(Config<object>) Defines the delegate that will be invoked against each input document to get the case comparison value.

Methods

Name Return Value Summary
AfterExecution(IExecutionContext, ExecutionOutputs) void
Called after each module execution.
Inherited from Module
AfterExecutionAsync(IExecutionContext, ExecutionOutputs) Task
Called after each module execution.
Inherited from Module
BeforeExecution(IExecutionContext) void
Called before each module execution.
Inherited from Module
BeforeExecutionAsync(IExecutionContext) Task
Called before each module execution.
Inherited from Module
Case(object, IEnumerable<IModule>) ExecuteSwitch
Defines a case.
Case(object, IModule[]) ExecuteSwitch
Defines a case.
Default(IEnumerable<IModule>) ExecuteSwitch
Defines modules to execute against documents that don't match a case.
Default(IModule[]) ExecuteSwitch
Defines modules to execute against documents that don't match a case.
ExecuteAsync(IExecutionContext) Task<IEnumerable<IDocument>>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
ExecuteContextAsync(IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module once for all input documents.
ExecuteInputAsync(IDocument, IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module.
Inherited from Module
Finally(IExecutionContext) void
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
FinallyAsync(IExecutionContext) Task
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module

Extension Methods