Class FileHelperFileTarget<TInput>
A dataflow worker with one Input port, for writing incoming data rows as delimited
(e.g. CSV) or fixed format records to a file.
Note: Use the factory methods in FileHelperFileTargetFactory to create instances of this class.
Please see CSV Delimited and Fixed Format for how to specify the data format. Internally, this worker uses the http://www.filehelpers.net/ library to read the data, specifically the FileHelperAsyncEngine class.
Implements
Inherited Members
Namespace: actionETL.FileHelper
Assembly: actionETL.dll
Syntax
[CLSCompliant(false)]
public class FileHelperFileTarget<TInput> : WorkerBase<FileHelperFileTarget<TInput>>, IDisposeOnFinished where TInput : class
Type Parameters
| Name | Description |
|---|---|
| TInput | The type of each |
Properties
AppendMode
Gets or sets a value indicating whether any existing file should be overwritten or appended to.
Set to true to append; false (the default) to overwrite.
Cannot be set after the worker has started running.
Note: This property is thread-safe.
Declaration
public bool AppendMode { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Cannot set the value after the worker has started running. |
Engine
Gets the underlying FileHelpers FileHelperAsyncEngine instance. Use this for customizing the data transfer, such as setting the text encoding and preprocess the data records. See CSV Delimited and Fixed Format for details.
Note: Retrieving and inspecting this property is thread-safe,
but modifying the Engine state is not thread-safe, and should only
be done from a single thread, before the worker has started.
Declaration
public FileHelperAsyncEngine<TInput> Engine { get; }
Property Value
| Type | Description |
|---|---|
| FileHelpers.FileHelperAsyncEngine<TInput> | The FileHelpers engine instance. |
Remarks
Note that in rare cases, and only when using non-C# .NET languages, direct use of the
Engine property can fail with a compile time error since the underlying FileHelpers
library class (FileHelperAsyncEngine) is not CLS compliant (warning CS3003).
FileName
The filename (including optional path) to write to. Cannot be set after the worker has started running.
Note: This property is thread-safe.
Declaration
public string FileName { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Cannot set the value after the worker has started running. |
FooterText
The footer text to write at the end of the output, if any.
Defaults to the names of the members written to the output.
Set it to null to not output any header text.
Any non-null string will be output verbatim.
Cannot be set after the worker has started running.
Note: This property is thread-safe.
Declaration
public string FooterText { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Cannot set the value after the worker has started running. |
HeaderText
The header text to write at the start of the output, if any.
Defaults to the names of the members written to the output.
Set it to null to not output any header text.
Any non-null string will be output verbatim.
Cannot be set after the worker has started running.
Note: This property is thread-safe.
Declaration
public string HeaderText { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Cannot set the value after the worker has started running. |
Input
Gets the input port for receiving rows from an upstream worker.
Declaration
public InputPort<TInput> Input { get; }
Property Value
| Type | Description |
|---|---|
| InputPort<TInput> |
Methods
RunAsync()
This method can be overridden to add custom functionality to the derived worker that runs before
and after the row processing. In this case, the base class base.RunAsync() must
be called for the worker to function correctly.
Typically, this worker is used without overriding this method.
Declaration
protected override Task<OutcomeStatus> RunAsync()
Returns
| Type | Description |
|---|---|
| Task<OutcomeStatus> | A |