C# Class Habanero.DB.DatabaseConfig

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

Méthodes publiques

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

Méthodes protégées

Méthode Description
Clone ( ) : DatabaseConfig

Private Methods

Méthode Description
DatabaseConfig ( ) : System

A deparameterised constructor

Method Details

Clone() protected méthode

protected Clone ( ) : DatabaseConfig
Résultat DatabaseConfig

DatabaseConfig() public méthode

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"
Résultat System

DatabaseConfig() public méthode

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

Equals() public méthode

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

GetConnection() public méthode

Creates a database connection using the configuration settings stored
public GetConnection ( ) : IDbConnection
Résultat IDbConnection

GetConnectionString() public méthode

Returns a connection string tailored for the database vendor
public GetConnectionString ( ) : String
Résultat String

GetDatabaseConnection() public méthode

Creates a database connection using the configuration settings stored
public GetDatabaseConnection ( ) : IDatabaseConnection
Résultat IDatabaseConnection

GetHashCode() public méthode

Returns the hashcode of all the settings added together
public GetHashCode ( ) : int
Résultat int

ISupportsRSADecryption() public méthode

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))
Résultat void

ReadFromConfigFile() public static méthode

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

ReadFromConfigFile() public static méthode

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

SetPrivateKey() public méthode

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

SetPrivateKey() public méthode

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))
Résultat void

ToString() public méthode

Returns a string with all the settings listed
public ToString ( ) : string
Résultat string