Class SystemConfiguration
- Namespace
- Dynamicweb.Configuration
- Assembly
- Dynamicweb.Configuration.dll
Provides access to all settings in GlobalSettings.aspx and .config files located in the /Files folder.
Uses the XmlConfigurationProvider to return values from settings stored in xml files.
public sealed class SystemConfiguration : ConfigurationManager
- Inheritance
-
SystemConfiguration
- Inherited Members
- Extension Methods
Examples
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))
{
}
}
}
}
}
Properties
FilesDirectory
Gets or sets the full path for the folder containing the configuration files.
[Obsolete("Use Dynamicweb.Core.SystemInformation.MapPath(\"/Bin\") instead.)")]
public static DirectoryInfo FilesDirectory { get; set; }
Property Value
Instance
Gets the current instance of the system configuration manager with data loaded from configuration files.
public static SystemConfiguration Instance { get; }
Property Value
Methods
Reset()
Resets the system configuration instance and reloads settings from configuration files.
public static void Reset()