ProviderBase.Initialize(String, NameValueCollection) Method

Definition

Initializes the configuration builder.

C#
public virtual void Initialize(string name, System.Collections.Specialized.NameValueCollection config);

Parameters

name
String

The friendly name of the provider.

config
NameValueCollection

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

Exceptions

The name of the provider is null.

The name of the provider has a length of zero.

An attempt is made to call Initialize(String, NameValueCollection) on a provider after the provider has already been initialized.

Examples

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

Remarks

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.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also