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

连接字符串。

注解

如果现有连接(如果有)处于打开状态,则可能无法更改连接字符串。

有关详细信息 和示例,请参阅连接和连接字符串

适用于