C# Class Habanero.DB.DatabaseSettings

Stores database settings as a cache and updates or retrieves settings either from the cache or from the database if the cache value has expired
Inheritance: System.MarshalByRefObject, ISettings
Afficher le fichier Open project: Chillisoft/habanero Class Usage Examples

Méthodes publiques

Méthode Description
DatabaseSettings ( IDatabaseConnection databaseConnection ) : System

Constructor to initialise an empty store of settings, using the table name of "settings"

DatabaseSettings ( string tableName, IDatabaseConnection databaseConnection ) : System

Constructor to initialise an empty store of settings, specifying the table name to use to store the settings

GetBoolean ( string settingName ) : bool

Returns a specified setting as a boolean

GetDecimal ( string settingName ) : decimal

Returns the configuration for the setting name provided

GetDecimal ( string settingName, System.DateTime date ) : decimal

Returns a specified setting as a decimal

GetString ( string settingName ) : string

Returns a specified setting as a string

GetString ( string settingName, System.DateTime date ) : string

Returns a specified setting as a string

HasSetting ( string settingName ) : bool

Returns whether the setting exists or not.

SetBoolean ( string settingName, bool boolValue ) : void

Sets a specified setting as a boolean

SetDecimal ( string settingName, decimal settingValue ) : void

Sets a setting with a decimal value (using the InvariantCulture). Uses DateTime.Now for the date of the setting to indicate when the setting was changed.

SetString ( string settingName, string settingValue ) : void

Sets a specified setting as a string

Private Methods

Méthode Description
CreateInsertStatement ( string settingName, string settingValue ) : SqlStatement

Creates a sql insert statement from the name and value provided

CreateSelectStatement ( string settingName, System.DateTime date ) : SqlStatement

Creates a sql select statement to retrieve the named setting at the date specified

CreateUpdateStatementNoDate ( string settingName, string settingValue ) : SqlStatement

Creates a sql update statement from the name and value provided, with no date specified

GetValue ( string settingName, System.DateTime date ) : object

Retrieves the named setting with the date specified, either from the cache or from the database if the cached value has expired

RetrieveSettingValue ( string settingName, System.DateTime date, object &value ) : bool
SetValue ( string settingName, string settingValue ) : void

Updates the named setting in the database with the value specified

UpdateCache ( string settingName ) : void

Refreshes the cached setting stored in this instance, by retrieving the updated setting from the database

Method Details

DatabaseSettings() public méthode

Constructor to initialise an empty store of settings, using the table name of "settings"
public DatabaseSettings ( IDatabaseConnection databaseConnection ) : System
databaseConnection IDatabaseConnection
Résultat System

DatabaseSettings() public méthode

Constructor to initialise an empty store of settings, specifying the table name to use to store the settings
public DatabaseSettings ( string tableName, IDatabaseConnection databaseConnection ) : System
tableName string The table name in which to store settings
databaseConnection IDatabaseConnection
Résultat System

GetBoolean() public méthode

Returns a specified setting as a boolean
public GetBoolean ( string settingName ) : bool
settingName string The setting name
Résultat bool

GetDecimal() public méthode

Returns the configuration for the setting name provided
public GetDecimal ( string settingName ) : decimal
settingName string The setting name
Résultat decimal

GetDecimal() public méthode

Returns a specified setting as a decimal
public GetDecimal ( string settingName, System.DateTime date ) : decimal
settingName string The setting name
date System.DateTime The date at which to check the setting
Résultat decimal

GetString() public méthode

Returns a specified setting as a string
public GetString ( string settingName ) : string
settingName string The setting name
Résultat string

GetString() public méthode

Returns a specified setting as a string
public GetString ( string settingName, System.DateTime date ) : string
settingName string The setting name
date System.DateTime The date of the setting to retrieve /// (ie this method will retrieve the setting value as at this date
Résultat string

HasSetting() public méthode

Returns whether the setting exists or not.
public HasSetting ( string settingName ) : bool
settingName string The name of the setting to look for.
Résultat bool

SetBoolean() public méthode

Sets a specified setting as a boolean
public SetBoolean ( string settingName, bool boolValue ) : void
settingName string The setting name
boolValue bool The value to set it to
Résultat void

SetDecimal() public méthode

Sets a setting with a decimal value (using the InvariantCulture). Uses DateTime.Now for the date of the setting to indicate when the setting was changed.
public SetDecimal ( string settingName, decimal settingValue ) : void
settingName string The name of the setting to set
settingValue decimal The value to set the setting to.
Résultat void

SetString() public méthode

Sets a specified setting as a string
public SetString ( string settingName, string settingValue ) : void
settingName string The setting name
settingValue string The value to set it to
Résultat void