ReadDataModule<TModule, TItem> Class
A base class for modules that read documents from data that can be turned into a Dictionary<string,object>.
Namespace
Statiq.Common
Interfaces
Base Types
Derived Types
graph BT Type-->Base0["SyncModule"] click Base0 "/api/Statiq.Common/SyncModule" Base0-->Base1["Module"] click Base1 "/api/Statiq.Common/Module" Base1-->Base2["object"] Type-.->Interface0["IModule"] click Interface0 "/api/Statiq.Common/IModule" Type["ReadDataModule<TModule, TItem>"] class Type type-node Derived0["ReadSql"]-->Type click Derived0 "/api/Statiq.Core/ReadSql" Derived1["ReadXml"]-->Type click Derived1 "/api/Statiq.Core/ReadXml"

Syntax

public abstract class ReadDataModule<TModule, TItem> : SyncModule, IModule 
    where TModule : ReadDataModule<TModule, TItem> where TItem : class

Type Parameters

Name Description
TModule The current module type, allows fluent methods defined in the base class to return the properly typed derived class.
TItem The type of items this module is designed to process.

Methods

Name Return Value Summary
AddKeyConversion(string, string) TModule
Allows renaming of keys during document creation: "If you find key X, create it as key Y instead".
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
ExcludeKeys(string[]) TModule
Allows creation of a list of keys to discard.
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
ExecuteContext(IExecutionContext) IEnumerable<IDocument>
Executes the module once for all input documents.
ExecuteContextAsync(IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module once for all input documents.
Inherited from SyncModule
ExecuteInput(IDocument, IExecutionContext) IEnumerable<IDocument>
Executes the module.
ExecuteInputAsync(IDocument, IExecutionContext) Task<IEnumerable<IDocument>>
Executes the module.
Inherited from SyncModule
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
GetDictionary(TItem) IDictionary<string, object>
Used to convert each object from GetItems(IExecutionContext) into a IDictionary<string, object>. The base implementation checks if the object implements IDictionary<string, object> and just performs a cast is if it does. If not, reflection is used to construct a IDictionary<string, object> from all of the object's properties. Override this method to provide an alternate way of getting key-value pairs for each object.
GetItems(IExecutionContext) IEnumerable<TItem>
Gets the items to convert to documents. The GetDictionary(TItem) method is used to convert each item into a series of key-value pairs that is then used for document creation.
IncludeKeys(string[]) TModule
Allows creation of a list of keys to keep. If this list any members, any keys other than those in this list will be discarded.
WithContentKey(string) TModule
Specifies which metadata key should be used for the document content.
WithLimit(int) TModule
Limits the number of created documents.

Extension Methods