Class CsvDataConnector
Provides access to data in a CSV (Character Separated Values) file.
public sealed class CsvDataConnector : FileDataConnector, IDisposable
- Inheritance
-
CsvDataConnector
- Implements
- Inherited Members
Constructors
CsvDataConnector(XmlNode)
Initializes a new instance of the CsvDataConnector class.
public CsvDataConnector(XmlNode node)
Parameters
nodeXmlNodeAn XML node containing the definition of the source.
CsvDataConnector(string, string, bool)
Initializes a new instance of the CsvDataConnector class.
public CsvDataConnector(string name, string fileName, bool withHeaders)
Parameters
namestringThe name of the source.
fileNamestringThe name of the CSV file.
withHeadersboolSets the initial value of the WithHeaders property.
Remarks
This constructor overload sets the IncludeFile property to Indeterminate
CsvDataConnector(string, string, bool, CheckState)
Initializes a new instance of the CsvDataConnector class.
public CsvDataConnector(string name, string fileName, bool withHeaders, CheckState includeFile)
Parameters
namestringThe name of the source.
fileNamestringThe name of the CSV file.
withHeadersboolSets the initial value of the WithHeaders property.
includeFileCheckStateSets the initial value of the IncludeFile property.
Properties
IncludeFile
Gets or sets a value specifying whether the file should be included into the associated project.
public override CheckState IncludeFile { get; set; }
Property Value
- CheckState
A value specifying whether to include the file into the associated project.
LastParseSeparatorChar
Gets the separator character used when last parsing the data from the CSV file.
public char LastParseSeparatorChar { get; }
Property Value
- char
The separator character used for the last parsing operation or the default separator character ',' if this source has not yet loaded data from the CSV file.
SeparatorChar
Gets or sets the separator character.
public char? SeparatorChar { get; set; }
Property Value
- char?
The separator character.
Remarks
If the value of this property is set to null, the source will try
to automatically detect the separator character when parsing the data from the CSV file.
WithHeaders
Gets or sets a value indicating whether the CSV file contains a header specifying column names.
public bool WithHeaders { get; set; }
Property Value
- bool
trueif the CSV file contains a header specifying column names; otherwise,false.
Remarks
This property influences the way data is parsed from and written to the CSV file.
If setting this property to true, the first line in the file is regarded as the
header containing the names of the data columns
XmlIdentifier
Gets the unique identifier for serialization and deserialization purposes as well as factory creation.
public override string XmlIdentifier { get; }
Property Value
Methods
GetXMLNodeDerived(XmlNode)
Add DataSource specific information from derived classes to the node
protected override void GetXMLNodeDerived(XmlNode node)
Parameters
nodeXmlNodeThe node to which information should be added.
LoadColumnsImpl(out ColumnCollection)
Loads the data columns from the CSV file.
protected override void LoadColumnsImpl(out ColumnCollection columns)
Parameters
columnsColumnCollectionThe loaded columns.
LoadDataImpl(out ColumnCollection, out RowCollection)
Loads the data from the CSV file.
protected override void LoadDataImpl(out ColumnCollection columns, out RowCollection rows)
Parameters
columnsColumnCollectionThe loaded columns.
rowsRowCollectionThe loaded rows.
StoreData(ColumnCollection, RowCollection, string)
Stores the data to the CSV file.
public void StoreData(ColumnCollection columns, RowCollection rows, string fileName)
Parameters
columnsColumnCollectionThe columns to store.
rowsRowCollectionThe rows to store.
fileNamestringThe name of the file to write to.
StoreDataImpl(ColumnCollection, RowCollection)
Stores the data to the CSV file.
protected override void StoreDataImpl(ColumnCollection columns, RowCollection rows)
Parameters
columnsColumnCollectionThe columns to store.
rowsRowCollectionThe rows to store.