ConfigurationProviders

This property enables one or more centralized configuration providers.

Declaration

// C#
public static string ConfigurationProviders { get; set; }

Property Type

System.String

Exception

  • ArgumentException: Thrown when ConfigurationProviders contains an invalid configuration provider, or None is used with another provider, or the string is otherwise not properly formatted.

  • ArgumentNullExcpetion: Thrown when ConfigurationProviders is set to null

Remarks

This property allows applications to enforce restrictions on which providers can be used.

Table 6-34 ConfigurationProviders Values

Value Description

All

Enables all configuration providers. This is the default value.

None

Disables all configuration providers

Azure

Enables Azure App configuration provider

AzureVault

Enables Azure Vault Configuration provider

OCIObject

Enables Oracle Cloud Infrastructure (OCI) Configuration provider

OCIVault

Enables OCI Vault Configuration provider

File

Enable local file provider

The values are case-insensitive.

These values must be set prior to opening a connection with a centralized configuration provider. They cannot be modified after a connection is opened. The values are not verified until a URL is used upon the connection open.

Any combination of configuration providers can be enabled.

OracleConfiguration.ConfigurationProviders = "File, OCIObject";
      

Optionally, the list of providers can be enclosed in parentheses. For example, the following code sample enables Azure App configuration provider and OCI Configuration provider.

OracleConfiguration.ConfigurationProviders = "(Azure, OCIObject)";
        

Duplicate values are ignored, such as (Azure, OCIObject, Azure), and do not create an exception.

Using None in a list with other providers throws an exception, such as (All, None) or (None, OCIVault).

Setting the value to empty parentheses () will be the same as using None. However, using an empty string is invalid, and will result in an error when the value is verified.

Using All in a list with other providers enables all providers, such as (File, Azure, All).

For JSON-based providers, the providers used within the JSON config must also be enabled. For example, if the file provider uses an OCI Vault URL to store the password, both File and OCIVault must be enabled.

This setting can also be used in sqlnet.ora or .NET configuration file. The precedence order, from highest to lowest, is:

  1. OracleConfiguration.ConfigurationParameters

  2. .NET Config

  3. sqlnet.ora

Alternatively, instead of using a string value, use the OracleConfigurationProvider enumeration and bitwise the enums to enable multiple providers. Only OracleConfiguration ConfigurationProviders property allows this. Sqlnet.ora CONFIGURATION_PROVIDERS and .NET configuration file ConfigurationProviders do not support using this enumeration. They only support string values. Here is a code sample using ConfigurationProviders to enable the Azure App Configuration, OCI Object, and Azure Vault providers.

OracleConfiguration.ConfigurationProviders = OracleConfigurationProvider.Azure |
OracleConfigurationProvider.OCIObject | OracleConfigurationProvider.AzureVault;