Table of Contents

Class SystemConfiguration

Namespace
Dynamicweb.Configuration
Assembly
Dynamicweb.Core.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 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

Instance

Gets the current instance of the system configuration manager with data loaded from configuration files.

public static SystemConfiguration Instance { get; }

Property Value

SystemConfiguration

Remarks

Please try to avoid using this method and instance inject SystemConfiguration as a dependency or use Current to resolve it.

Methods

Reset()

Resets the system configuration instance and reloads settings from configuration files.

public static void Reset()

Remarks

Please try to avoid using this method and instance inject SystemConfiguration as a dependency or use Current to resolve it.

To top