Third Attempt, Format Converter |
Data Conveyer excels at transforming data. Let's see how can we translate comma separated values into key value pairs (keyword data).
There are several data kinds (formats) natively supported by Data Conveyer. Conversion between any of these formats is a simple matter of specifying the respective configuration settings.
using Mavidian.DataConveyer; using Mavidian.DataConveyer.Orchestrators; var config = new OrchestratorConfig() { InputDataKind = KindOfTextData.Delimited, InputFileName = "input.csv", HeadersInFirstInputRow = true, OutputDataKind = KindOfTextData.Keyword, OutputFileName = "output.kw" }; using (var orchtr = OrchestratorCreator.GetEtlOrchestrator(config)) { orchtr.ExecuteAsync(); }
In the code above, we have included the InputDataKind and OutputDataKind properties, which should be self-explanatory. We also set the HeadersInFirstInputRow property to true, which tells Data Conveyer that the first input row contains column headers (field names) and not the actual data.
Note |
---|
A careful reader's eye will notice the using block, which simply tells the Data Conveyer to dispose the orchestrator after completing its work (Data Conveyer's orchestrators implement the IDisposable interface). It is not strictly necessary, but considered best practice in order to conserve memory. |