ExecuteIf Class
Evaluates a series of child modules for each input document if a specified condition is met.
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-.->Interface1["IList<IfCondition>"] Type-.->Interface2["ICollection<IfCondition>"] Type-.->Interface3["IEnumerable<IfCondition>"] Type-.->Interface4["IEnumerable"] Type["ExecuteIf"] class Type type-node

Syntax

public class ExecuteIf : Module, IModule, IList<IfCondition>, ICollection<IfCondition>, 
    IEnumerable<IfCondition>, IEnumerable

Remarks

Any result documents from the child modules will be returned as the result of the this module. Any input documents that don't match a predicate will be returned as outputs without modification.

Constructors

Name Summary
ExecuteIf(Config<bool>, IEnumerable<IModule>) Specifies a predicate and a series of child modules to be evaluated if the predicate returns true.
ExecuteIf(Config<bool>, IModule[]) Specifies a predicate and a series of child modules to be evaluated if the predicate returns true.
ExecuteIf(IEnumerable<string>, IEnumerable<IModule>) Specifies child modules to be evaluated if a given metadata key is present in the input document.
ExecuteIf(IEnumerable<string>, IModule[]) Specifies child modules to be evaluated if a given metadata key is present in the input document.
ExecuteIf(string, IEnumerable<IModule>) Specifies child modules to be evaluated if a given metadata key is present in the input document.
ExecuteIf(string, IModule[]) Specifies child modules to be evaluated if a given metadata key is present in the input document.

Properties

Name Property Type Summary
Count int
IsReadOnly bool
this[int] IfCondition

Methods

Name Return Value Summary
Add(IfCondition) void
Add(IModule) void
Adds a module to the initial condition. This method is mainly to support collection initialization of the module.
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
Clear() void
Contains(IfCondition) bool
CopyTo(IfCondition[], int) void
Else(IEnumerable<IModule>) IModule
This should be at the end of your fluent method chain and will evaluate the specified child modules on all documents that did not satisfy previous predicates. The predicate will be evaluated against every input document individually.
Else(IModule[]) IModule
This should be at the end of your fluent method chain and will evaluate the specified child modules on all documents that did not satisfy previous predicates. The predicate will be evaluated against every input document individually.
ElseIf(Config<bool>, IEnumerable<IModule>) ExecuteIf
Specifies an alternate condition to be tested on documents that did not satisfy previous conditions. You can chain together as many ElseIf calls as needed.
ElseIf(Config<bool>, IModule[]) ExecuteIf
Specifies an alternate condition to be tested on documents that did not satisfy previous conditions. You can chain together as many ElseIf calls as needed.
ElseIf(string, IEnumerable<IModule>) ExecuteIf
Specifies an alternate condition to be tested on documents that did not satisfy previous conditions. You can chain together as many ElseIf calls as needed.
ElseIf(string, IModule[]) ExecuteIf
Specifies an alternate condition to be tested on documents that did not satisfy previous conditions. You can chain together as many ElseIf calls as needed.
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
GetEnumerator() IEnumerator<IfCondition>
IndexOf(IfCondition) int
Insert(int, IfCondition) void
Remove(IfCondition) bool
RemoveAt(int) void
WithoutUnmatchedDocuments(bool) ExecuteIf
The default behavior of this module is to "fall through" any documents that didn't match one of the conditions and add it to the result set. This method allows you to change that behavior and prevent unmatched documents from being added to the result set.

Extension Methods

Name Value Summary
AddRange<IfCondition>(IEnumerable<IfCondition>) void
Adds a range of values to a collection.
AddRange<IfCondition>(IfCondition[]) void
Adds a range of values to a collection.
Concat<IfCondition>(IfCondition) IEnumerable<T>
ForEachDocument() ForEachDocument
GetNext<IfCondition>(IfCondition, IEqualityComparer<IfCondition>) T
GetNext<IfCondition>(IfCondition) T
GetPrevious<IfCondition>(IfCondition, IEqualityComparer<IfCondition>) T
GetPrevious<IfCondition>(IfCondition) T
GroupByMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, TElement>, IEqualityComparer<TKey>) IEnumerable<IGrouping<TKey, TElement>>
Groups the elements of a sequence according to a specified key selector function that returns a sequence of keys. The keys are compared by using a comparer and each group's elements are projected by using a specified function.
GroupByMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, TElement>) IEnumerable<IGrouping<TKey, TElement>>
Groups the elements of a sequence according to a specified key selector function that returns a sequence of keys and projects the elements for each group by using a specified function.
GroupByMany<IfCondition, TKey>(Func<IfCondition, IEnumerable<TKey>>, IEqualityComparer<TKey>) IEnumerable<IGrouping<TKey, TSource>>
Groups the elements of a sequence according to a specified key selector function that returns a sequence of keys and compares the keys by using a specified comparer.
GroupByMany<IfCondition, TKey>(Func<IfCondition, IEnumerable<TKey>>) IEnumerable<IGrouping<TKey, TSource>>
Groups the elements of a sequence according to a specified key selector function that returns a sequence of keys.
GroupByManyToMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, IEnumerable<TElement>>, IEqualityComparer<TKey>) IEnumerable<IGrouping<TKey, TElement>>
Groups the elements of a sequence according to a specified key selector function that returns a sequence of keys. The keys are compared by using a comparer and each group's elements are projected by using a specified function that returns a sequence of elements.
GroupByManyToMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, IEnumerable<TElement>>) IEnumerable<IGrouping<TKey, TElement>>
Groups the elements of a sequence according to a specified key selector function that returns a sequence of keys and projects the elements for each group by using a specified function that returns a sequence of elements.
ParallelForEachAsync<IfCondition>(Func<IfCondition, Task>, CancellationToken) Task
ParallelSelectAsync<IfCondition, TResult>(Func<IfCondition, Task<TResult>>, CancellationToken) Task<IEnumerable<TResult>>
Invokes an async selector in parallel.
ParallelSelectManyAsync<IfCondition, TResult>(Func<IfCondition, Task<IEnumerable<TResult>>>, CancellationToken) Task<IEnumerable<TResult>>
Invokes an async selector that returns multiple results in parallel.
ParallelWhereAsync<IfCondition>(Func<IfCondition, Task<bool>>, CancellationToken) Task<IEnumerable<TSource>>
RemoveAll<IfCondition>(Func<IfCondition, bool>) int
Removes all items that match a predicate from a collection.
StartsWith<IfCondition>(IEnumerable<IfCondition>, IEqualityComparer<IfCondition>) bool
Determines whether the items starts with the specified values.
StartsWith<IfCondition>(IEnumerable<IfCondition>) bool
Determines whether the items starts with the specified values.
ThrowIfNull<ExecuteIf>(string) T
ToDocument<ExecuteIf>(IContentProvider) IDocument
ToDocument<ExecuteIf>(IEnumerable<KeyValuePair<string, object>>, IContentProvider) IDocument
ToDocument<ExecuteIf>(NormalizedPath, IContentProvider) IDocument
ToDocument<ExecuteIf>(NormalizedPath, IEnumerable<KeyValuePair<string, object>>, IContentProvider) IDocument
ToDocument<ExecuteIf>(NormalizedPath, NormalizedPath, IContentProvider) IDocument
ToDocument<ExecuteIf>(NormalizedPath, NormalizedPath, IEnumerable<KeyValuePair<string, object>>, IContentProvider) IDocument
ToDocuments<IfCondition>(Func<IfCondition, IContentProvider>) IEnumerable<IDocument>
ToDocuments<IfCondition>(Func<IfCondition, IEnumerable<KeyValuePair<string, object>>>, Func<IfCondition, IContentProvider>) IEnumerable<IDocument>
ToDocuments<IfCondition>(Func<IfCondition, NormalizedPath>, Func<IfCondition, IContentProvider>) IEnumerable<IDocument>
ToDocuments<IfCondition>(Func<IfCondition, NormalizedPath>, Func<IfCondition, IEnumerable<KeyValuePair<string, object>>>, Func<IfCondition, IContentProvider>) IEnumerable<IDocument>
ToDocuments<IfCondition>(Func<IfCondition, NormalizedPath>, Func<IfCondition, NormalizedPath>, Func<IfCondition, IContentProvider>) IEnumerable<IDocument>
ToDocuments<IfCondition>(Func<IfCondition, NormalizedPath>, Func<IfCondition, NormalizedPath>, Func<IfCondition, IEnumerable<KeyValuePair<string, object>>>, Func<IfCondition, IContentProvider>) IEnumerable<IDocument>
ToLookupMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, TElement>, IEqualityComparer<TKey>) ILookup<TKey, TElement>
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys. The keys are compared by using a comparer and each group's elements are projected by using a specified function.
ToLookupMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, TElement>) ILookup<TKey, TElement>
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys and projects the elements for each group by using a specified function.
ToLookupMany<IfCondition, TKey>(Func<IfCondition, IEnumerable<TKey>>, IEqualityComparer<TKey>) ILookup<TKey, TSource>
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys and compares the keys by using a specified comparer.
ToLookupMany<IfCondition, TKey>(Func<IfCondition, IEnumerable<TKey>>) ILookup<TKey, TSource>
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys.
ToLookupManyToMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, IEnumerable<TElement>>, IEqualityComparer<TKey>) ILookup<TKey, TElement>
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys. The keys are compared by using a comparer and each group's elements are projected by using a specified function that returns a sequence of elements.
ToLookupManyToMany<IfCondition, TKey, TElement>(Func<IfCondition, IEnumerable<TKey>>, Func<IfCondition, IEnumerable<TElement>>) ILookup<TKey, TElement>
Creates a lookup from a sequence according to a specified key selector function that returns a sequence of keys and projects the elements for each group by using a specified function that returns a sequence of elements.
ToStringTable<IfCondition>(string[], Func<IfCondition, object>[]) string