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)
The ProviderConfigurationSettings type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ProviderConfigurationSettings | Initializes a new instance of the ProviderConfigurationSettings class. |
| Name | Description | |
|---|---|---|
![]() | ProviderSpecificSettings | Gets the System.Collections..::..IList interface that contains the collection of provider specific settings. |
![]() | Settings | When overridden in a derived class, gets the collection of settings that are specific to the host environment. |
| Name | Description | |
|---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetSettings | Returns an array that contains the settings of the provider configuration. |
![]() | GetType | (Inherited from Object.) |
![]() | LoadSettings | Loads the settings from the specified array into the provider configuration settings. |
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
![]() | Validate | When overridden in a derived class, validates the provider configuration settings. |
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" }; providerConfigSettings.LoadSettings(arraysettings); 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; } } } } }



