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
-
- object
- Module
- SyncModule
- 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 |
TModule |
Allows renaming of keys during document creation: "If you find key X, create it as key Y instead".
|
AfterExecution |
void |
Called after each module execution.
Inherited from Module
|
AfterExecutionAsync |
Task |
Called after each module execution.
Inherited from Module
|
BeforeExecution |
void |
Called before each module execution.
Inherited from Module
|
BeforeExecutionAsync |
Task |
Called before each module execution.
Inherited from Module
|
ExcludeKeys |
TModule |
Allows creation of a list of keys to discard.
|
ExecuteAsync |
Task |
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 |
IEnumerable |
Executes the module once for all input documents.
|
ExecuteContextAsync |
Task |
Executes the module once for all input documents.
Inherited from SyncModule
|
ExecuteInput |
IEnumerable |
Executes the module.
|
ExecuteInputAsync |
Task |
Executes the module.
Inherited from SyncModule
|
Finally |
void |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
FinallyAsync |
Task |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
GetDictionary |
IDictionary |
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 |
IEnumerable |
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 |
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 |
TModule |
Specifies which metadata key should be used for the document content.
|
WithLimit |
TModule |
Limits the number of created documents.
|