ConfigurationExtensions.GetConnectionString(IConfiguration, String) 方法

定义

Retrieves the value with the specified key from the ConnectionStrings 配置源的节。 调用此方法是简写的 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

参数

configuration
IConfiguration

配置。

name
String

连接字符串键。

返回

String

具有指定键的连接字符串。

适用于