共用方式為


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);
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

連接字串索引鍵。

傳回

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

適用於