C# 클래스 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.
상속: ConnectionDescriptor
파일 보기 프로젝트 열기: azavea/net-dao-csv 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
OutputQuoteLevel CsvQuoteLevel
Path string
Reader System.IO.StreamReader
Type CsvConnectionType
Writer System.IO.TextWriter

보호된 프로퍼티들

프로퍼티 타입 설명
HasBeenWrittenTo bool

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
CsvDescriptor ( CsvConnectionType type, string path, TextWriter writer, StreamReader reader, CsvQuoteLevel quoteLevel ) : System

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

메소드 상세

CreateDataAccessLayer() 공개 메소드

Returns the appropriate data access layer for this connection.
public CreateDataAccessLayer ( ) : IDaLayer
리턴 IDaLayer

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 보호된 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

CsvDescriptor() 공개 메소드

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.
리턴 System

ToCleanString() 공개 메소드

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
리턴 string

ToCompleteString() 공개 메소드

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
리턴 string

프로퍼티 상세

HasBeenWrittenTo 보호되어 있는 프로퍼티

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
리턴 bool

OutputQuoteLevel 공개적으로 프로퍼티

How verbosely do we quote values that we write to the file. Default is to quote all strings.
public CsvQuoteLevel OutputQuoteLevel
리턴 CsvQuoteLevel

Path 공개적으로 프로퍼티

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
리턴 string

Reader 공개적으로 프로퍼티

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
리턴 System.IO.StreamReader

Type 공개적으로 프로퍼티

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

Writer 공개적으로 프로퍼티

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
리턴 System.IO.TextWriter