C# Class Habanero.DB.DatabaseConfig

Stores database configuration settings and creates connections using these settings
Inheritance: IDatabaseConfig, ISupportsRSADecryption
Mostrar archivo Open project: Chillisoft/habanero Class Usage Examples

Public Methods

Method Description
DatabaseConfig ( IDictionary settings ) : System

A constructor as before, but with the configuration settings passed as an IDictionary object

DatabaseConfig ( string vendor, string server, string database, string userName, string password, string port ) : System

A constructor with specific configurations provided

Equals ( object obj ) : bool

Checks whether this database configuration is equal to that of the object provided

GetConnection ( ) : IDbConnection

Creates a database connection using the configuration settings stored

GetConnectionString ( ) : String

Returns a connection string tailored for the database vendor

GetDatabaseConnection ( ) : IDatabaseConnection

Creates a database connection using the configuration settings stored

GetHashCode ( ) : int

Returns the hashcode of all the settings added together

ISupportsRSADecryption ( string xmlPrivateKey ) : void

Sets the private key to use to decrypt the password. The private key is in xml format.

ReadFromConfigFile ( ) : DatabaseConfig

Creates a new configuration object by reading the "DatabaseConfig" settings from the project's configuration settings

ReadFromConfigFile ( string configSectionName ) : DatabaseConfig

Creates a new configuration object by reading the "DatabaseConfig" settings from the project's configuration settings

SetPrivateKey ( RSA privateKey ) : void

Sets the private key to use to decrypt password. The private key is an RSA object.

SetPrivateKey ( string xmlPrivateKey ) : void

Sets the private key to use to decrypt the password. The private key is in xml format.

ToString ( ) : string

Returns a string with all the settings listed

Protected Methods

Method Description
Clone ( ) : DatabaseConfig

Private Methods

Method Description
DatabaseConfig ( ) : System

A deparameterised constructor

Method Details

Clone() protected method

protected Clone ( ) : DatabaseConfig
return DatabaseConfig

DatabaseConfig() public method

A constructor as before, but with the configuration settings passed as an IDictionary object
public DatabaseConfig ( IDictionary settings ) : System
settings IDictionary An IDictionary object containing entries /// for "vendor", "server", "database", "username", "password" and /// "port"
return System

DatabaseConfig() public method

A constructor with specific configurations provided
public DatabaseConfig ( string vendor, string server, string database, string userName, string password, string port ) : System
vendor string The database vendor - use the strings /// provided (eg. DatabaseConfig.MySql)
server string The database server
database string The database name
userName string The username
password string The password
port string The port
return System

Equals() public method

Checks whether this database configuration is equal to that of the object provided
public Equals ( object obj ) : bool
obj object The object to compare with, which must be a /// type of DatabaseConfig
return bool

GetConnection() public method

Creates a database connection using the configuration settings stored
public GetConnection ( ) : IDbConnection
return IDbConnection

GetConnectionString() public method

Returns a connection string tailored for the database vendor
public GetConnectionString ( ) : String
return String

GetDatabaseConnection() public method

Creates a database connection using the configuration settings stored
public GetDatabaseConnection ( ) : IDatabaseConnection
return IDatabaseConnection

GetHashCode() public method

Returns the hashcode of all the settings added together
public GetHashCode ( ) : int
return int

ISupportsRSADecryption() public method

Sets the private key to use to decrypt the password. The private key is in xml format.
public ISupportsRSADecryption ( string xmlPrivateKey ) : void
xmlPrivateKey string The xml format of the RSA key (RSA.ToXmlString(true))
return void

ReadFromConfigFile() public static method

Creates a new configuration object by reading the "DatabaseConfig" settings from the project's configuration settings
public static ReadFromConfigFile ( ) : DatabaseConfig
return DatabaseConfig

ReadFromConfigFile() public static method

Creates a new configuration object by reading the "DatabaseConfig" settings from the project's configuration settings
public static ReadFromConfigFile ( string configSectionName ) : DatabaseConfig
configSectionName string The name of the Config Setting Section where the database connection settings are stored.
return DatabaseConfig

SetPrivateKey() public method

Sets the private key to use to decrypt password. The private key is an RSA object.
public SetPrivateKey ( RSA privateKey ) : void
privateKey System.Security.Cryptography.RSA The RSA object which has the private key
return void

SetPrivateKey() public method

Sets the private key to use to decrypt the password. The private key is in xml format.
public SetPrivateKey ( string xmlPrivateKey ) : void
xmlPrivateKey string The xml format of the RSA key (RSA.ToXmlString(true))
return void

ToString() public method

Returns a string with all the settings listed
public ToString ( ) : string
return string