Share via


SqliteDbContextOptionsBuilderExtensions.UseSqlite Method

Definition

Overloads

UseSqlite(DbContextOptionsBuilder, Action<SqliteDbContextOptionsBuilder>)

Configures the context to connect to a SQLite database, but without initially setting any DbConnection or connection string.

UseSqlite(DbContextOptionsBuilder, DbConnection, Action<SqliteDbContextOptionsBuilder>)

Configures the context to connect to a SQLite database.

UseSqlite(DbContextOptionsBuilder, String, Action<SqliteDbContextOptionsBuilder>)

Configures the context to connect to a SQLite database.

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

Configures the context to connect to a SQLite database.

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

Configures the context to connect to a SQLite database, but without initially setting any DbConnection or connection string.

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

Configures the context to connect to a SQLite database.

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

Configures the context to connect to a SQLite database.

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

Configures the context to connect to a SQLite database.

UseSqlite(DbContextOptionsBuilder, Action<SqliteDbContextOptionsBuilder>)

Configures the context to connect to a SQLite database, but without initially setting any DbConnection or connection string.

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

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

The connection or connection string must be set before the DbContext is used to connect to a database. Set a connection using SetDbConnection(DatabaseFacade, DbConnection, Boolean). Set a connection string using SetConnectionString(DatabaseFacade, String).

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to

UseSqlite(DbContextOptionsBuilder, DbConnection, Action<SqliteDbContextOptionsBuilder>)

Configures the context to connect to a SQLite database.

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

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

connection
DbConnection

An existing DbConnection to be used to connect to the database. If the connection is in the open state then EF will not open or close the connection. If the connection is in the closed state then EF will open and close the connection as needed. The caller owns the connection and is responsible for its disposal.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to

UseSqlite(DbContextOptionsBuilder, String, Action<SqliteDbContextOptionsBuilder>)

Configures the context to connect to a SQLite database.

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

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

connectionString
String

The connection string of the database to connect to.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to

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

Configures the context to connect to a SQLite database.

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

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

connection
DbConnection

An existing DbConnection to be used to connect to the database. If the connection is in the open state then EF will not open or close the connection. If the connection is in the closed state then EF will open and close the connection as needed.

contextOwnsConnection
Boolean

If true, then EF will take ownership of the connection and will dispose it in the same way it would dispose a connection created by EF. If false, then the caller still owns the connection and is responsible for its disposal.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to

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

Configures the context to connect to a SQLite database, but without initially setting any DbConnection or connection string.

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)

Type Parameters

TContext

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

The connection or connection string must be set before the DbContext is used to connect to a database. Set a connection using SetDbConnection(DatabaseFacade, DbConnection, Boolean). Set a connection string using SetConnectionString(DatabaseFacade, String).

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to

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

Configures the context to connect to a SQLite database.

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)

Type Parameters

TContext

The type of context to be configured.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

connection
DbConnection

An existing DbConnection to be used to connect to the database. If the connection is in the open state then EF will not open or close the connection. If the connection is in the closed state then EF will open and close the connection as needed. The caller owns the connection and is responsible for its disposal.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to

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

Configures the context to connect to a SQLite database.

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)

Type Parameters

TContext

The type of context to be configured.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

connectionString
String

The connection string of the database to connect to.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to

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

Configures the context to connect to a SQLite database.

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)

Type Parameters

TContext

The type of context to be configured.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

connection
DbConnection

An existing DbConnection to be used to connect to the database. If the connection is in the open state then EF will not open or close the connection. If the connection is in the closed state then EF will open and close the connection as needed.

contextOwnsConnection
Boolean

If true, then EF will take ownership of the connection and will dispose it in the same way it would dispose a connection created by EF. If false, then the caller still owns the connection and is responsible for its disposal.

sqliteOptionsAction
Action<SqliteDbContextOptionsBuilder>

An optional action to allow additional SQLite specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing SQLite databases with EF Core for more information and examples.

Applies to