C# Class 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.
Inheritance: IConnectionDescriptor
Afficher le fichier Open project: azavea/net-dao

Protected Properties

Свойство Type Description
_log log4net.ILog

Méthodes publiques

Méthode Description
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().

Méthodes protégées

Méthode Description
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.

Method Details

CreateDataAccessLayer() public abstract méthode

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
Résultat IDaLayer

Equals() public méthode

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.
Résultat bool

GetDecryptedConfigParameter() protected static méthode

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.
Résultat string

GetHashCode() public méthode

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
Résultat int

LoadFromConfig() public static méthode

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.
Résultat IConnectionDescriptor

LoadFromConfig() public static méthode

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.
Résultat IConnectionDescriptor

ToCleanString() public abstract 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 abstract ToCleanString ( ) : string
Résultat string

ToCompleteString() public abstract 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 abstract ToCompleteString ( ) : string
Résultat string

ToString() public méthode

For convenience, this returns ToCleanString().
public ToString ( ) : string
Résultat string

Property Details

_log protected_oe static_oe property

The log4net logger which child classes may use to log any appropriate messages.
protected static ILog,log4net _log
Résultat log4net.ILog