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

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

将上下文配置为连接到 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)设置连接字符串。

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于

UseSqlite(DbContextOptionsBuilder, DbConnection, Action<SqliteDbContextOptionsBuilder>)

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

配置上下文以连接到 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 的配置。

返回

选项生成器,以便可以链接进一步的配置。

注解

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于

UseSqlite(DbContextOptionsBuilder, String, Action<SqliteDbContextOptionsBuilder>)

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

配置上下文以连接到 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 的配置。

返回

选项生成器,以便可以链接进一步的配置。

注解

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于

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

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

配置上下文以连接到 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 的配置。

返回

选项生成器,以便可以链接进一步的配置。

注解

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于

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

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

将上下文配置为连接到 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)设置连接字符串。

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于

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

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

配置上下文以连接到 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 的配置。

返回

选项生成器,以便可以链接进一步的配置。

注解

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于

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

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

配置上下文以连接到 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 的配置。

返回

选项生成器,以便可以链接进一步的配置。

注解

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于

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

Source:
SqliteDbContextOptionsBuilderExtensions.cs
Source:
SqliteDbContextOptionsBuilderExtensions.cs

配置上下文以连接到 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 的配置。

返回

选项生成器,以便可以链接进一步的配置。

注解

有关详细信息和示例,请参阅 使用 DbContextOptions使用 EF Core 访问 SQLite 数据库

适用于