Sql Class

Summary

Creates documents from the results of a SQL query. Each row is output as a new document and every column is used as the metadata (or content) of the new document. Input documents are ignored.
Assembly
Wyam.Core.dll
Namespace
Wyam.Core.Modules.Metadata
Interfaces
Base Types
graph BT Type-->Base0["ReadDataModule<Sql, DataRow>"] Base0-->Base1["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type["Sql"] class Type type-node

Syntax

public class Sql : ReadDataModule<Sql, DataRow>, IModule

Constructors

Name Summary
Sql(string, string) Creates documents from a SQL query given the specified connection string and query.

Methods

Name Value Summary
GetDictionary(DataRow) IDictionary<string, Object>
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(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<DataRow>
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.
GitHub