共用方式為


RelationalDatabaseFacadeExtensions.SetConnectionString 方法

定義

設定為此 DbContext 設定的基礎連接字串。

public static void SetConnectionString (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, string connectionString);
public static void SetConnectionString (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, string? connectionString);
static member SetConnectionString : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * string -> unit
<Extension()>
Public Sub SetConnectionString (databaseFacade As DatabaseFacade, connectionString As String)

參數

databaseFacade
DatabaseFacade

DatabaseFacade內容的 。

connectionString
String

連接字串。

備註

如果現有的連接已開啟,可能無法變更連接字串。

如需詳細資訊 和範例,請參閱連線和連接字串

適用於