Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ProviderConfigurationSettings Class

Provides the base class for displaying the provider configuration settings.


Namespace:  Microsoft.Web.Management.Client
Assembly:  Microsoft.Web.Management (in Microsoft.Web.Management.dll)

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public abstract class ProviderConfigurationSettings

The ProviderConfigurationSettings type exposes the following members.

Protected methodProviderConfigurationSettingsInitializes a new instance of the ProviderConfigurationSettings class.

Public propertyProviderSpecificSettingsGets the System.Collections..::..IList interface that contains the collection of provider specific settings.
Protected propertySettingsWhen overridden in a derived class, gets the collection of settings that are specific to the host environment.

Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetSettingsReturns an array that contains the settings of the provider configuration.
Public methodGetType (Inherited from Object.)
Public methodLoadSettingsLoads the settings from the specified array into the provider configuration settings.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Public methodValidateWhen overridden in a derived class, validates the provider configuration settings.

This class enables the derived class to check the settings of the provider.

Notes to Inheritors

When you inherit from the ProviderConfigurationSettings class, you must override the following members: Settings property and Validate method.

The following example builds a custom ProviderConfigSettings class, which is derived from the ProviderConfigurationSettings class. The example loads and initializes the provider configuration settings and then uses the GetSettings method to obtain the key/value pairs. Finally, the Validate method checks for validation.

using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.Web.Management.Client;

namespace ConfigSnippets {
    class Program {
        static void Main(string[] args) {
            ProviderConfigSettings providerConfigSettings = new ProviderConfigSettings();
            // Load the settings.
            string[] arraysettings = { 
                "key0", "value0", 
                "key1", "value1", 
                "key2", "value2" 
            Console.WriteLine("\nLoadSettings count: " + arraysettings.Length);

            // Display the settings.
            IDictionary<string, string> settings;
            settings = (IDictionary<string, string>)providerConfigSettings.GetSettings();
            Console.WriteLine("There are " + settings.Count +
                " key value pairs in ProviderConfigSettings.");
            foreach (KeyValuePair<string, string> keyValuePair in settings) {
                Console.WriteLine("  " + keyValuePair.Key + ": " + keyValuePair.Value);

            // Perform a validation check on the provider configuration settings.
            string newmessage;
            bool retval = providerConfigSettings.Validate(out newmessage);
            Console.WriteLine("\nValidation returns a " + retval);
            Console.WriteLine("Validation message: " + newmessage);

        public class ProviderConfigSettings : ProviderConfigurationSettings {
            IDictionary<string, string> _settings = new Dictionary<string, string>();

            // overrides the abstract Settings property.
            protected override System.Collections.IDictionary Settings {
                get {
                    return (IDictionary)_settings;

            // Overrides the abstract Validate method.
            public override bool Validate(out string message) {
                // Perform a validation check. If the key pairs collection
                // contains more than three pairs, pass a return value of 
                // false and a failure message.
                if (_settings.Count < 4) {
                    message = "Validation succesful";
                    return true;
                } else {
                    message = "Validation failed - too many key value pairs";
                    return false;

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

© 2015 Microsoft