ProviderBase.Initialize(String, NameValueCollection) 方法

定义

初始化配置生成器。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)

参数

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.

异常

提供程序的名称是 nullThe name of the provider is null.

提供程序名称的长度为零。The name of the provider has a length of zero.

初始化提供程序后尝试在提供程序上调用 Initialize(String, NameValueCollection)An attempt is made to call Initialize(String, NameValueCollection) on a provider after the provider has already been initialized.

示例

有关如何使用Initialize的示例, 请参阅分析提供程序实现示例For an example of how to use Initialize, see Profile Provider Implementation Example.

注解

基类实现在内部跟踪提供程序Initialize方法的调用次数。The base class implementation internally tracks the number of times the provider's Initialize method has been called. 如果提供程序多次初始化, InvalidOperationException则会引发, 指出提供程序已经初始化。If a provider is initialized more than once, an InvalidOperationException is thrown stating that the provider is already initialized.

由于大多数功能提供程序Initialize在执行特定于提供程序的初始化之前调用, 因此此方法是一个用于阻止双初始化的中心位置。Because most feature providers call Initialize prior to performing provider-specific initialization, this method is a central location for preventing double initialization.

适用于

另请参阅