ProvidersHelper.InstantiateProvider Method (ProviderSettings, Type)

 

Initializes and returns a single provider of the given type using the supplied settings.

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

<AspNetHostingPermissionAttribute(SecurityAction.Demand, Level := AspNetHostingPermissionLevel.Low)>
Public Shared Function InstantiateProvider (
	providerSettings As ProviderSettings,
	providerType As Type
) As ProviderBase

Parameters

providerSettings
Type: System.Configuration.ProviderSettings

The settings to be passed to the provider upon initialization.

providerType
Type: System.Type

The Type of the provider to be initialized.

Return Value

Type: System.Configuration.Provider.ProviderBase

A new provider of the given type using the supplied settings.

Exception Condition
ArgumentException

The provider type defined in configuration was null or an empty string ("").

- or -

The provider type defined in configuration is not compatible with the type used by the feature that is attempting to create a new instance of the provider.

ConfigurationErrorsException

The provider threw an exception while it was being initialized.

- or -

An error occurred while attempting to resolve a Type instance for the provider specified in providerSettings.

.NET Framework
Available since 2.0
Return to top
Show: