SystemConfiguration Class |
Namespace: Dynamicweb.Configuration
The SystemConfiguration type exposes the following members.
Name | Description | |
---|---|---|
FilesDirectory | Obsolete.
Gets or sets the full path for the folder containing the configuration files.
| |
Instance |
Gets the current instance of the system configuration manager with data loaded from configuration files.
|
Name | Description | |
---|---|---|
AddProvider |
Adds an instance of IConfigurationProvider. This enables multiple providers to contribute the the same ConfigurationManager.
(Inherited from ConfigurationManager.) | |
AddProviderPriority |
Adds an instance of IConfigurationProvider as the first provider in the provider list giving it priority over the system configuration provider.
This enables multiple providers to contribute the the same ConfigurationManager.
(Inherited from ConfigurationManager.) | |
Contains |
Determines whether the configuration contains the specified key.
(Inherited from ConfigurationManager.) | |
Get | Obsolete.
Gets the String value for the specified key.
(Inherited from ConfigurationManager.) | |
GetBoolean |
Gets the Boolean value for the specified key.
(Inherited from ConfigurationManager.) | |
GetInt32 |
Gets the Int32 value for the specified key.
(Inherited from ConfigurationManager.) | |
GetKeys |
Gets all keys that can be used to get or set data.
(Inherited from ConfigurationManager.) | |
GetValue |
Gets the String value for the specified key.
(Inherited from ConfigurationManager.) | |
Reset |
Resets the system configuration instance and reloads settings from configuration files.
| |
SetT(DictionaryString, String) | Obsolete.
Sets a collection configuration entries.
(Inherited from ConfigurationManager.) | |
SetT(String, T) | Obsolete.
Sets value of the entry with the specified key.
(Inherited from ConfigurationManager.) | |
SetValueT(DictionaryString, String) | Obsolete.
Sets the value.
(Inherited from ConfigurationManager.) | |
SetValueT(String, T) |
Sets value of the entry with the specified key.
(Inherited from ConfigurationManager.) | |
TryGetT |
Attempts to get the value associated with the specified key.
(Inherited from ConfigurationManager.) |
Name | Description | |
---|---|---|
AddXml | (Defined by ConfigurationManagerXmlExtensions.) | |
AddXmlFile |
Adds an xml configuration file to the configuration manager.
(Defined by ConfigurationManagerXmlExtensions.) |
namespace Dynamicweb.Configuration.Examples { class ConfigurationSample { void Configure() { // Setting a configuration value SystemConfiguration.Instance.SetValue("/Globalsettings/Modules/MyModule/Feature", true); // Getting a configuration setting as a string value string dbserver = SystemConfiguration.Instance.GetValue("/Globalsettings/System/Database/Server"); // Getting a configuration setting as an integer value int maxAttempts = SystemConfiguration.Instance.GetInt32("/Globalsettings/Modules/MyModule/MaxAttempts"); // Getting a configuration setting as a boolean value bool useFeature = SystemConfiguration.Instance.GetBoolean("/Globalsettings/Modules/MyModule/UseFeature"); // Getting a configuration setting using TryGet string apiKey; if (SystemConfiguration.Instance.TryGet("/Globalsettings/Modules/MyModule/ApiKey", out apiKey)) { if (!string.IsNullOrEmpty(apiKey)) { } } } } }