共用方式為


SqliteDbContextOptionsBuilderExtensions.UseSqlite 方法

定義

多載

UseSqlite(DbContextOptionsBuilder, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫,但一開始未設定任何 DbConnection 或連接字串。

UseSqlite(DbContextOptionsBuilder, DbConnection, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

UseSqlite(DbContextOptionsBuilder, String, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

UseSqlite(DbContextOptionsBuilder, DbConnection, Boolean, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫,但一開始未設定任何 DbConnection 或連接字串。

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, DbConnection, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, String, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, DbConnection, Boolean, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

UseSqlite(DbContextOptionsBuilder, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫,但一開始未設定任何 DbConnection 或連接字串。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> sqliteOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default);
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseSqlite (optionsBuilder As DbContextOptionsBuilder, Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

參數

optionsBuilder
DbContextOptionsBuilder

用來設定內容的產生器。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

必須先設定 DbContext 連線或連接字串,才能用來連線到資料庫。 使用 SetDbConnection(DatabaseFacade, DbConnection, Boolean) 設定連線。 使用 SetConnectionString(DatabaseFacade, String) 設定連接字串。

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於

UseSqlite(DbContextOptionsBuilder, DbConnection, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, System.Data.Common.DbConnection connection, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> sqliteOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, System.Data.Common.DbConnection connection, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default);
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * System.Data.Common.DbConnection * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseSqlite (optionsBuilder As DbContextOptionsBuilder, connection As DbConnection, Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

參數

optionsBuilder
DbContextOptionsBuilder

用來設定內容的產生器。

connection
DbConnection

要用來連接到資料庫的現有 DbConnection 。 如果連線處於開啟狀態,EF 將不會開啟或關閉連線。 如果連線處於關閉狀態,EF 會視需要開啟並關閉連線。 呼叫端擁有連線,並負責其處置。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於

UseSqlite(DbContextOptionsBuilder, String, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string connectionString, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> sqliteOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string connectionString, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string? connectionString, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default);
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseSqlite (optionsBuilder As DbContextOptionsBuilder, connectionString As String, Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

參數

optionsBuilder
DbContextOptionsBuilder

用來設定內容的產生器。

connectionString
String

要連線的資料庫連接字串。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於

UseSqlite(DbContextOptionsBuilder, DbConnection, Boolean, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseSqlite (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, System.Data.Common.DbConnection connection, bool contextOwnsConnection, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default);
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * System.Data.Common.DbConnection * bool * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseSqlite (optionsBuilder As DbContextOptionsBuilder, connection As DbConnection, contextOwnsConnection As Boolean, Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

參數

optionsBuilder
DbContextOptionsBuilder

用來設定內容的產生器。

connection
DbConnection

要用來連接到資料庫的現有 DbConnection 。 如果連線處於開啟狀態,EF 將不會開啟或關閉連線。 如果連線處於關閉狀態,EF 會視需要開啟並關閉連線。

contextOwnsConnection
Boolean

如果是 true ,則 EF 會取得連線的擁有權,並以相同方式處置 EF 所建立的連線。 如果 false 為 ,則呼叫端仍擁有連線,並負責其處置。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫,但一開始未設定任何 DbConnection 或連接字串。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseSqlite(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

類型參數

TContext

參數

optionsBuilder
DbContextOptionsBuilder<TContext>

用來設定內容的產生器。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

必須先設定 DbContext 連線或連接字串,才能用來連線到資料庫。 使用 SetDbConnection(DatabaseFacade, DbConnection, Boolean) 設定連線。 使用 SetConnectionString(DatabaseFacade, String) 設定連接字串。

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, DbConnection, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, System.Data.Common.DbConnection connection, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, System.Data.Common.DbConnection connection, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * System.Data.Common.DbConnection * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseSqlite(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), connection As DbConnection, Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

類型參數

TContext

要設定的內容類型。

參數

optionsBuilder
DbContextOptionsBuilder<TContext>

用來設定內容的產生器。

connection
DbConnection

要用來連接到資料庫的現有 DbConnection 。 如果連線處於開啟狀態,EF 將不會開啟或關閉連線。 如果連線處於關閉狀態,EF 會視需要開啟並關閉連線。 呼叫端擁有連線,並負責其處置。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, String, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string connectionString, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string connectionString, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string? connectionString, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseSqlite(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), connectionString As String, Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

類型參數

TContext

要設定的內容類型。

參數

optionsBuilder
DbContextOptionsBuilder<TContext>

用來設定內容的產生器。

connectionString
String

要連線的資料庫連接字串。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於

UseSqlite<TContext>(DbContextOptionsBuilder<TContext>, DbConnection, Boolean, Action<SqliteDbContextOptionsBuilder>)

設定內容以連線到 SQLite 資料庫。

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseSqlite<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, System.Data.Common.DbConnection connection, bool contextOwnsConnection, Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder>? sqliteOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseSqlite : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * System.Data.Common.DbConnection * bool * Action<Microsoft.EntityFrameworkCore.Infrastructure.SqliteDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseSqlite(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), connection As DbConnection, contextOwnsConnection As Boolean, Optional sqliteOptionsAction As Action(Of SqliteDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

類型參數

TContext

要設定的內容類型。

參數

optionsBuilder
DbContextOptionsBuilder<TContext>

用來設定內容的產生器。

connection
DbConnection

要用來連接到資料庫的現有 DbConnection 。 如果連線處於開啟狀態,EF 將不會開啟或關閉連線。 如果連線處於關閉狀態,EF 會視需要開啟並關閉連線。

contextOwnsConnection
Boolean

如果是 true ,則 EF 會取得連線的擁有權,並以相同方式處置 EF 所建立的連線。 如果 false 為 ,則呼叫端仍擁有連線,並負責其處置。

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

允許其他 SQLite 特定設定的選擇性動作。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 SQLite 資料庫

適用於