ConfigurationExtensions.GetConnectionString(IConfiguration, String) Method

Definition

Retrieves the value with the specified key from the ConnectionStrings section of the configuration source. Calling this method is shorthand for GetSection("ConnectionStrings")[name].

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ GetConnectionString(Microsoft::Extensions::Configuration::IConfiguration ^ configuration, System::String ^ name);
public static string GetConnectionString (this Microsoft.Extensions.Configuration.IConfiguration configuration, string name);
public static string? GetConnectionString (this Microsoft.Extensions.Configuration.IConfiguration configuration, string name);
static member GetConnectionString : Microsoft.Extensions.Configuration.IConfiguration * string -> string
<Extension()>
Public Function GetConnectionString (configuration As IConfiguration, name As String) As String

Parameters

configuration
IConfiguration

The configuration.

name
String

The connection string key.

Returns

String

The connection string with the specified key.

Applies to