ReadSql Class
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.
Namespace
Statiq.Core
Interfaces
Base Types
graph BT Type-->Base0["ReadDataModule<ReadSql, DataRow>"] Base0-->Base1["SyncModule"] click Base1 "/api/Statiq.Common/SyncModule" Base1-->Base2["Module"] click Base2 "/api/Statiq.Common/Module" Base2-->Base3["object"] Type-.->Interface0["IModule"] click Interface0 "/api/Statiq.Common/IModule" Type["ReadSql"] class Type type-node

Syntax

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

Constructors

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

Methods

Name Return Value Summary
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
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.
Inherited from SyncModule
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(DataRow) 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<DataRow>
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.

Extension Methods