Summary
A base class for modules that read documents from data that can be turned into a Dictionary<string,object>.
- Assembly
- Wyam
.Common .dll - Namespace
- Wyam
.Common .Modules - Interfaces
- Base Types
-
- Object
- Derived Types
graph BT
Type-->Base0["Object"]
Type-.->Interface0["IModule"]
click Interface0 "/api/Wyam.Common.Modules/IModule"
Type["ReadDataModule<TModule, TItem>"]
class Type type-node
Derived0["Objects"]-->Type
click Derived0 "/api/Wyam.Core.Modules.Metadata/Objects"
Derived1["Xml"]-->Type
click Derived1 "/api/Wyam.Core.Modules.Metadata/Xml"
Derived2["Sql"]-->Type
click Derived2 "/api/Wyam.Core.Modules.Metadata/Sql"
Syntax
public abstract class ReadDataModule<TModule, TItem> : 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 | Value | Summary |
---|---|---|
AddKeyConversion |
TModule |
Allows renaming of keys during document creation: "If you find key X, create it as key Y instead."
|
ExcludeKeys |
TModule |
Allows creation of a list of keys to discard.
|
Execute |
IEnumerable |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
|
GetDictionary |
IDictionary |
Used to convert each object from
Wyam.Common.Modules.ReadDataModule`2.GetItems(System.Collections.Generic.IReadOnlyList{Wyam.Common.Documents.IDocument},Wyam.Common.Execution.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
Wyam.Common.Modules.ReadDataModule`2.GetDictionary(`1) 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 metakey should be used for the document content
|
WithLimit |
TModule |
Limits the number of created documents.
|