C# 클래스 Azavea.Open.DAO.ConnectionDescriptor

This class represents the information needed to establish a connection to a data source. This class is abstract, and may be extended to represent a connection to any .NET data provider (or anything else that makes sense). This class, and any that extend it, should be thread safe.
상속: IConnectionDescriptor
파일 보기 프로젝트 열기: azavea/net-dao

보호된 프로퍼티들

프로퍼티 타입 설명
_log log4net.ILog

공개 메소드들

메소드 설명
CreateDataAccessLayer ( ) : IDaLayer

Returns the appropriate data access layer for this connection. If this connection is capable of performing "DDL" operations (creating / deleting datastores, indexes, etc) this IDaLayer will also implement IDaDdlLayer.

Equals ( object obj ) : bool

The default implementation does a comparison based on ToCompleteString. If this is inaccurate or inefficient for a given implementation, this method should be overridden.

GetHashCode ( ) : int

The default implementation uses the hashcode of ToCompleteString. If this is inaccurate or inefficient for a given implementation, this method should be overridden.

LoadFromConfig ( Config cfg, string section ) : IConnectionDescriptor

This is a factory method, that will load the appropriate type of connection descriptor using the given config. It first searches for config item(s) called "ConnectionConfigSection" and/or "ConnectionConfig". (ConnectionConfig should be an "app name" for a config, not a file name). If present, it will use those to load from another section in this or another config file. This allows more dynamic install-time configuration of DB connections. You may daisy-chain the configuration if you wish. Once in the connection configuration section, it will first search for the "DescriptorClass" config item, and use that class if specified. If not, defaults to an OleDbDescriptor (which means it should be backwards compatible for all our existing config files).

LoadFromConfig ( Config cfg, string section, ConnectionInfoDecryptionDelegate decryptionDelegate ) : IConnectionDescriptor

This is a factory method, that will load the appropriate type of connection descriptor using the given config. It first searches for config item(s) called "ConnectionConfigSection" and/or "ConnectionConfig". (ConnectionConfig should be an "app name" for a config, not a file name). If present, it will use those to load from another section in this or another config file. This allows more dynamic install-time configuration of DB connections. You may daisy-chain the configuration if you wish. Once in the connection configuration section, it will first search for the "DescriptorClass" config item, and use that class if specified. If not, defaults to an OleDbDescriptor (which means it should be backwards compatible for all our existing config files).

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.

ToString ( ) : string

For convenience, this returns ToCleanString().

보호된 메소드들

메소드 설명
GetDecryptedConfigParameter ( Config config, string component, string paramName, ConnectionInfoDecryptionDelegate decryptionDelegate ) : string

This method is provided for convenience. If decryptionDelegate is not null, will use it to decrypt whatever value is in the config parameter.

메소드 상세

CreateDataAccessLayer() 공개 추상적인 메소드

Returns the appropriate data access layer for this connection. If this connection is capable of performing "DDL" operations (creating / deleting datastores, indexes, etc) this IDaLayer will also implement IDaDdlLayer.
public abstract CreateDataAccessLayer ( ) : IDaLayer
리턴 IDaLayer

Equals() 공개 메소드

The default implementation does a comparison based on ToCompleteString. If this is inaccurate or inefficient for a given implementation, this method should be overridden.
public Equals ( object obj ) : bool
obj object Other descriptor to compare with.
리턴 bool

GetDecryptedConfigParameter() 보호된 정적인 메소드

This method is provided for convenience. If decryptionDelegate is not null, will use it to decrypt whatever value is in the config parameter.
protected static GetDecryptedConfigParameter ( Config config, string component, string paramName, ConnectionInfoDecryptionDelegate decryptionDelegate ) : string
config Azavea.Open.Common.Config Config file to get the parameter from.
component string Section within the config file.
paramName string Name of the paraneter within the section.
decryptionDelegate ConnectionInfoDecryptionDelegate Method to call to decrypt the parameter. May be null if using plain text.
리턴 string

GetHashCode() 공개 메소드

The default implementation uses the hashcode of ToCompleteString. If this is inaccurate or inefficient for a given implementation, this method should be overridden.
public GetHashCode ( ) : int
리턴 int

LoadFromConfig() 공개 정적인 메소드

This is a factory method, that will load the appropriate type of connection descriptor using the given config. It first searches for config item(s) called "ConnectionConfigSection" and/or "ConnectionConfig". (ConnectionConfig should be an "app name" for a config, not a file name). If present, it will use those to load from another section in this or another config file. This allows more dynamic install-time configuration of DB connections. You may daisy-chain the configuration if you wish. Once in the connection configuration section, it will first search for the "DescriptorClass" config item, and use that class if specified. If not, defaults to an OleDbDescriptor (which means it should be backwards compatible for all our existing config files).
public static LoadFromConfig ( Config cfg, string section ) : IConnectionDescriptor
cfg Azavea.Open.Common.Config Config to load the descriptor info from.
section string What section of that config has the DB connection info in it.
리턴 IConnectionDescriptor

LoadFromConfig() 공개 정적인 메소드

This is a factory method, that will load the appropriate type of connection descriptor using the given config. It first searches for config item(s) called "ConnectionConfigSection" and/or "ConnectionConfig". (ConnectionConfig should be an "app name" for a config, not a file name). If present, it will use those to load from another section in this or another config file. This allows more dynamic install-time configuration of DB connections. You may daisy-chain the configuration if you wish. Once in the connection configuration section, it will first search for the "DescriptorClass" config item, and use that class if specified. If not, defaults to an OleDbDescriptor (which means it should be backwards compatible for all our existing config files).
public static LoadFromConfig ( Config cfg, string section, ConnectionInfoDecryptionDelegate decryptionDelegate ) : IConnectionDescriptor
cfg Azavea.Open.Common.Config Config to load the descriptor info from.
section string What section of that config has the DB connection info in it.
decryptionDelegate ConnectionInfoDecryptionDelegate Method to call to decrypt information, if the actual /// connection descriptor type supports decryption. May be null.
리턴 IConnectionDescriptor

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 abstract 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 abstract ToCompleteString ( ) : string
리턴 string

ToString() 공개 메소드

For convenience, this returns ToCleanString().
public ToString ( ) : string
리턴 string

프로퍼티 상세

_log 보호되어 있는 정적으로 프로퍼티

The log4net logger which child classes may use to log any appropriate messages.
protected static ILog,log4net _log
리턴 log4net.ILog