C# Class Azavea.Open.DAO.CSV.CsvDescriptor

Connection descriptor representing a CSV file that you intend to read/write/modify/etc. For CSV files, your mapping may map either to column names (which assumes the first row of the CSV is a header row) or column indexes (1-based, since that's what spreadsheets use). See CsvConnectionType for more information on how CSV descriptors can be configured.
Inheritance: ConnectionDescriptor
Afficher le fichier Open project: azavea/net-dao-csv Class Usage Examples

Méthodes publiques

Свойство Type Description
OutputQuoteLevel CsvQuoteLevel
Path string
Reader System.IO.StreamReader
Type CsvConnectionType
Writer System.IO.TextWriter

Protected Properties

Свойство Type Description
HasBeenWrittenTo bool

Méthodes publiques

Méthode Description
CreateDataAccessLayer ( ) : IDaLayer

Returns the appropriate data access layer for this connection.

CsvDescriptor ( Config config, string component, ConnectionInfoDecryptionDelegate decryptionDelegate ) : System

Populates the descriptor's values from a config file.

CsvDescriptor ( CsvConnectionType type, string path ) : System

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case.

CsvDescriptor ( CsvConnectionType type, string path, CsvQuoteLevel quoteLevel ) : System

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case. Allows you to specify the verbosity of quotes when we write the file.

CsvDescriptor ( StreamReader reader ) : System

Creates a descriptor using a StreamReader. See CsvConnectionType for a description of the behavior when using a StreamReader.

CsvDescriptor ( StreamReader reader, CsvQuoteLevel quoteLevel ) : System

Creates a descriptor using a StreamReader. See CsvConnectionType for a description of the behavior when using a StreamReader. Allows you to specify the verbosity of quotes when we write to the stream.

CsvDescriptor ( TextWriter writer ) : System

Creates a descriptor using a TextWriter. See CsvConnectionType for a description of the behavior when using a TextWriter.

CsvDescriptor ( TextWriter writer, CsvQuoteLevel quoteLevel ) : System

Creates a descriptor using a TextWriter. See CsvConnectionType for a description of the behavior when using a TextWriter. Allows you to specify the verbosity of quotes when we write to the stream.

CsvDescriptor ( string path ) : System

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case.

CsvDescriptor ( string path, CsvQuoteLevel quoteLevel ) : System

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case. Allows you to specify the verbosity of quotes when we write the file.

ToCleanString ( ) : string

This method is similar to ToString, except it will not contain any "sensitive" information, I.E. passwords. This method is intended to be used for logging or error handling, where we do not want to display passwords to (potentially) just anyone, but we do want to indicate what DB connection we were using.

ToCompleteString ( ) : string

Since we often need to represent database connection info as strings, child classes must implement ToCompleteString() such that this.Equals(that) and this.ToCompleteString().Equals(that.ToCompleteString()) will behave the same.

Méthodes protégées

Méthode Description
CsvDescriptor ( CsvConnectionType type, string path, TextWriter writer, StreamReader reader, CsvQuoteLevel quoteLevel ) : System

Creates a descriptor from any possible combination of inputs / configuration.

Method Details

CreateDataAccessLayer() public méthode

Returns the appropriate data access layer for this connection.
public CreateDataAccessLayer ( ) : IDaLayer
Résultat IDaLayer

CsvDescriptor() public méthode

Populates the descriptor's values from a config file.
public CsvDescriptor ( Config config, string component, ConnectionInfoDecryptionDelegate decryptionDelegate ) : System
config Azavea.Open.Common.Config Config to get params from.
component string Section of the config XML to look in for db params.
decryptionDelegate ConnectionInfoDecryptionDelegate Delegate to call to decrypt password fields. /// May be null if passwords are in plain text.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case.
public CsvDescriptor ( CsvConnectionType type, string path ) : System
type CsvConnectionType Which type is it, a file or a directory.
path string Path to the CSV file or directory. Will be created if it does not exist.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case. Allows you to specify the verbosity of quotes when we write the file.
public CsvDescriptor ( CsvConnectionType type, string path, CsvQuoteLevel quoteLevel ) : System
type CsvConnectionType Which type is it, a file or a directory.
path string Path to the CSV file or directory. Will be created if it does not exist.
quoteLevel CsvQuoteLevel How verbosely do we quote values we write.
Résultat System

CsvDescriptor() protected méthode

Creates a descriptor from any possible combination of inputs / configuration.
protected CsvDescriptor ( CsvConnectionType type, string path, TextWriter writer, StreamReader reader, CsvQuoteLevel quoteLevel ) : System
type CsvConnectionType May be InputStream or OutputStream if stream is not null, or /// Unknown if stream is null.
path string Path to the CSV file or directory. One of path, reader, writer /// must be set.
writer System.IO.TextWriter The writer to "insert" to. One of path, reader, writer /// must be set.
reader System.IO.StreamReader The reader to "query" against. One of path, reader, writer /// must be set.
quoteLevel CsvQuoteLevel How verbosely do we quote values we write.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor using a StreamReader. See CsvConnectionType for a description of the behavior when using a StreamReader.
public CsvDescriptor ( StreamReader reader ) : System
reader System.IO.StreamReader The reader to "query" against.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor using a StreamReader. See CsvConnectionType for a description of the behavior when using a StreamReader. Allows you to specify the verbosity of quotes when we write to the stream.
public CsvDescriptor ( StreamReader reader, CsvQuoteLevel quoteLevel ) : System
reader System.IO.StreamReader The reader to "query" against.
quoteLevel CsvQuoteLevel How verbosely do we quote values we write.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor using a TextWriter. See CsvConnectionType for a description of the behavior when using a TextWriter.
public CsvDescriptor ( TextWriter writer ) : System
writer System.IO.TextWriter The writer to "insert" to.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor using a TextWriter. See CsvConnectionType for a description of the behavior when using a TextWriter. Allows you to specify the verbosity of quotes when we write to the stream.
public CsvDescriptor ( TextWriter writer, CsvQuoteLevel quoteLevel ) : System
writer System.IO.TextWriter The writer to "insert" to.
quoteLevel CsvQuoteLevel How verbosely do we quote values we write.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case.
public CsvDescriptor ( string path ) : System
path string Path to the CSV file or directory. Must exist.
Résultat System

CsvDescriptor() public méthode

Creates a descriptor for the given path. If the path may either be a file or a directory, see CsvConnectionType for descriptions of the behavior in either case. Allows you to specify the verbosity of quotes when we write the file.
public CsvDescriptor ( string path, CsvQuoteLevel quoteLevel ) : System
path string Path to the CSV file or directory. Must exist.
quoteLevel CsvQuoteLevel How verbosely do we quote values we write.
Résultat System

ToCleanString() public méthode

This method is similar to ToString, except it will not contain any "sensitive" information, I.E. passwords. This method is intended to be used for logging or error handling, where we do not want to display passwords to (potentially) just anyone, but we do want to indicate what DB connection we were using.
public ToCleanString ( ) : string
Résultat string

ToCompleteString() public méthode

Since we often need to represent database connection info as strings, child classes must implement ToCompleteString() such that this.Equals(that) and this.ToCompleteString().Equals(that.ToCompleteString()) will behave the same.
public ToCompleteString ( ) : string
Résultat string

Property Details

HasBeenWrittenTo protected_oe property

This is a hack for the case where we're configured with someone else's TextWriter... we need to know whether to output a header row or not, and we only want to do that if we haven't written anything to the writer yet. This becomes true after anything is written to the TextWriter. If we are not using the Writer type this parameter is unused.
protected bool HasBeenWrittenTo
Résultat bool

OutputQuoteLevel public_oe property

How verbosely do we quote values that we write to the file. Default is to quote all strings.
public CsvQuoteLevel OutputQuoteLevel
Résultat CsvQuoteLevel

Path public_oe property

The name of the CSV file, or the directory with all the files, that we're reading or writing to. Will be null if a Stream was directly specified.
public string Path
Résultat string

Reader public_oe property

The StreamReader that we were programmatically configured to use. Will be null if we were configured to use a file or directory or TextWriter. Cannot be a TextReader because we need to be able to seek back to the beginning for subsequent queries, so we need to use the underlying stream for that operation.
public StreamReader,System.IO Reader
Résultat System.IO.StreamReader

Type public_oe property

How are we accessing the CSV, is it a single file, a directory full of files, or a programmatically-specified Stream?
public CsvConnectionType Type
Résultat CsvConnectionType

Writer public_oe property

The TextWriter that we were programmatically configured to use. Will be null if we were configured to use a file or directory or StreamReader.
public TextWriter,System.IO Writer
Résultat System.IO.TextWriter