編輯

共用方式為


ProviderBase.Initialize(String, NameValueCollection) Method

Definition

Initializes the configuration builder.

public:
 virtual void Initialize(System::String ^ name, System::Collections::Specialized::NameValueCollection ^ config);
public virtual void Initialize (string name, System.Collections.Specialized.NameValueCollection config);
abstract member Initialize : string * System.Collections.Specialized.NameValueCollection -> unit
override this.Initialize : string * System.Collections.Specialized.NameValueCollection -> unit
Public Overridable Sub Initialize (name As String, config As NameValueCollection)

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

See also