ProviderBase.Initialize Method (String, NameValueCollection)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes the configuration builder.

Namespace:   System.Configuration.Provider
Assembly:  System.Configuration (in System.Configuration.dll)

public virtual void Initialize(
	string name,
	NameValueCollection config
)

Parameters

name
Type: System.String

The friendly name of the provider.

config
Type: System.Collections.Specialized.NameValueCollection

A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.

Exception Condition
ArgumentNullException

The name of the provider is null.

ArgumentException

The name of the provider has a length of zero.

InvalidOperationException

An attempt is made to call Initialize on a provider after the provider has already been initialized.

The base class implementation internally tracks the number of times the provider's Initialize method has been called. If a provider is initialized more than once, an InvalidOperationException is thrown stating that the provider is already initialized.

Because most feature providers call Initialize prior to performing provider-specific initialization, this method is a central location for preventing double initialization.

For an example of how to use Initialize, see Profile Provider Implementation Example.

.NET Framework
Available since 2.0
Return to top
Show: