Class TextDocumentSource<TOutput>

Reads one text resource as one element. A line-based TextSource<TOutput> emits one row per line; this source emits the complete text of the current file, HTTP response, blob, or stream.

Inherited Members
Namespace: ETLBox.AI
Assembly: ETLBox.AI.dll
Syntax
    public class TextDocumentSource<TOutput> : DataFlowStreamSource<TOutput>, IDataFlowStreamSource<TOutput>, IDataFlowExecutableSource<TOutput>, IDataFlowStreamSource, IDataFlowExecutableSource, IDataFlowSource<TOutput>, IDataFlowSource, IDataFlowComponent, ILoggableTask
Type Parameters
NameDescription
TOutput

Type of outgoing data.

Examples
var source = new TextDocumentSource("docs/readme.md");
var chunk = new ChunkTransformation();
source.LinkTo(chunk);
var typed = new TextDocumentSource<Document>("docs/readme.md");
var custom = new TextDocumentSource<Document>("docs/readme.md") {
    ResultSelector = (text, metadata) => new Document {
        Source = metadata.RequestUri,
        Content = text
    }
};

Constructors

TextDocumentSource()

Declaration
    public TextDocumentSource()

TextDocumentSource(string)

Declaration
    public TextDocumentSource(string uri)
Parameters
TypeNameDescription
stringuri

The source of the file. This can be a filename or a web url.Uri

TextDocumentSource(string, ResourceType)

Declaration
    public TextDocumentSource(string uri, ResourceType resourceType)
Parameters
TypeNameDescription
stringuri

The source of the file. This can be a filename or a web url.Uri

ResourceTyperesourceType

Specifies if data is loaded from a file, a web endpoint or other storage types (e.g. Azure Blob Storage)

Properties

ResultSelector

Creates the outgoing element from the complete text and the metadata of the current resource. When set, this function is used instead of the ExpandoObject default or the document attributes.

Declaration
    public Func<string, StreamMetaData, TOutput> ResultSelector { get; set; }
Property Value
TypeDescription
Func<string, StreamMetaData, TOutput>

Methods

CheckParameter()

Declaration
    protected override void CheckParameter()
Overrides

CloseReader()

Declaration
    protected override void CloseReader()
Overrides

InitReader()

Declaration
    protected override void InitReader()
Overrides

ReadAllRecords()

Declaration
    protected override void ReadAllRecords()
Overrides

Implements