ConfigurationExtensions.GetConnectionString(IConfiguration, String) 方法

定義

從 擷取具有指定索引鍵的值 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

具有指定索引鍵的連接字串。

適用於