Class ConfigurationSectionWithAppSettingsBase
Summary description for ConfigurationSectionWithAppSettingsBase.
Inheritance
Namespace: ImageVault.Common.Lib.Configuration
Assembly: ImageVault.Common.dll
Syntax
public abstract class ConfigurationSectionWithAppSettingsBase : ConfigurationSectionRemarks
2011-08-10 dan: Created
Constructors
ConfigurationSectionWithAppSettingsBase(String)
Initializes a new instance of the ConfigurationSectionWithAppSettingsBase class.
Declaration
protected ConfigurationSectionWithAppSettingsBase(string sectionName)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | sectionName | 
Properties
ApplicationSettings
Get/Sets the ApplicationSettings of the CoreConfigurationSection
Declaration
public KeyValueConfigurationCollection ApplicationSettings { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Configuration.KeyValueConfigurationCollection | 
AppSettings
Gets the AppSettings of the CoreConfigurationSection
Declaration
public NameValueConfigurationCollectionWrapper AppSettings { get; }Property Value
| Type | Description | 
|---|---|
| NameValueConfigurationCollectionWrapper | 
Methods
GetAppSettingAsBool(String)
Gets the app settings value as a boolean
Declaration
protected bool? GetAppSettingAsBool(string key)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | key | The key of the app settings to get | 
Returns
| Type | Description | 
|---|---|
| System.Nullable<System.Boolean> | The found boolean or null if no boolean was entered. | 
Exceptions
| Type | Condition | 
|---|---|
| System.Configuration.ConfigurationErrorsException | if unable to parse value to boolean. | 
GetAppSettingAsInt(String, Int32)
Declaration
public int GetAppSettingAsInt(string key, int defaultValue)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | key | |
| System.Int32 | defaultValue | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | 
GetAppSettingAsUri(String)
Gets the app settings value as an Uri
Declaration
protected Uri GetAppSettingAsUri(string key)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | key | The key of the appsettings to get | 
Returns
| Type | Description | 
|---|---|
| System.Uri | The found uri or null if no uri was entered. | 
Exceptions
| Type | Condition | 
|---|---|
| System.Configuration.ConfigurationErrorsException | if unable to parse url . | 
GetXPathForAppSettingValue(String)
Gets the XPath expression for a specific app settings value
Declaration
protected string GetXPathForAppSettingValue(string key)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | key | The name(key) of the app setting | 
Returns
| Type | Description | 
|---|---|
| System.String | The xpath epression pointing to the value of the specific app setting | 
IsReadOnly()
Declaration
public override bool IsReadOnly()Returns
| Type | Description | 
|---|---|
| System.Boolean | True if read is only, otherwise false. | 
ReadFromConfiguration<T>()
Reads the configuration section from the current configuration or returns a newed up instance if it is missing
Declaration
public static T ReadFromConfiguration<T>()
    where T : ConfigurationSectionWithAppSettingsBase, new()Returns
| Type | Description | 
|---|---|
| T | The read or newed up instance. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The type of configuration section to read | 
ReplaceApplicationSettingValue(String, String)
Replaces the current AppSettings value with the given key/value pair. If an existing key is found, it is removed and replaced with the supplied one.
Declaration
public void ReplaceApplicationSettingValue(string name, string value)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | |
| System.String | value |