Rask.SQLite
0.19.0
See the version list below for details.
dotnet add package Rask.SQLite --version 0.19.0
NuGet\Install-Package Rask.SQLite -Version 0.19.0
<PackageReference Include="Rask.SQLite" Version="0.19.0" />
<PackageVersion Include="Rask.SQLite" Version="0.19.0" />
<PackageReference Include="Rask.SQLite" />
paket add Rask.SQLite --version 0.19.0
#r "nuget: Rask.SQLite, 0.19.0"
#:package Rask.SQLite@0.19.0
#addin nuget:?package=Rask.SQLite&version=0.19.0
#tool nuget:?package=Rask.SQLite&version=0.19.0
Rask.SQLite
Production-ready SQLite for .NET. Applies a tuned production pragma set — WAL journaling,
synchronous=NORMAL, foreign_keys=ON, a busy_timeout, a
shared mmap_size, and a capped journal_size_limit — to every SQLite connection, so your app
gets correct, concurrent, production-ready SQLite by default instead of the lock-prone stock config.
Standalone and lean: it depends only on Microsoft.Data.Sqlite and is reflection-free, so it is
fine under trimming/AOT and on mobile. You do not need the rest of Rask to use it.
Install
dotnet add package Rask.SQLite
Use
builder.Services.AddRaskSqlite($"Data Source={dbPath}");
// then inject IRaskSqliteConnectionFactory:
await using var connection = await factory.CreateOpenAsync(ct); // pragmas already applied
The production defaults are on out of the box; override any of them:
builder.Services.AddRaskSqlite($"Data Source={dbPath}", p =>
{
p.BusyTimeout = TimeSpan.FromSeconds(10);
p.CacheSize = -20_000; // negative ⇒ KiB, so 20 MB
p.TempStore = SqliteTempStore.Memory;
});
Concurrent writes: IMMEDIATE transactions + a non-blocking retry
For the write path under concurrency, ExecuteInImmediateTransactionAsync runs your work in a
BEGIN IMMEDIATE transaction and acquires the write lock through a non-blocking, fair-interval
retry — a constant 1 ms poll that yields the thread while it waits (no blocked
thread, no spurious database is locked):
await factory.ExecuteInImmediateTransactionAsync(async (connection, ct) =>
{
await using var cmd = connection.CreateCommand();
cmd.CommandText = "INSERT INTO WriteLogs (Note) VALUES ($note);";
cmd.Parameters.AddWithValue("$note", note);
await cmd.ExecuteNonQueryAsync(ct);
});
Tune it with AddRaskSqlite(cs, configureRetry: r => …) (defaults: 5 s timeout, 1 ms interval).
Using Entity Framework Core?
Add Rask.SQLite.EntityFrameworkCore
for the one-line UseRaskSqlite(...) (a drop-in for UseSqlite that wires the pragma interceptor).
It's a separate package so the pragma engine stays free of an EF Core dependency.
Defaults
| Pragma | Default |
|---|---|
journal_mode |
WAL |
synchronous |
NORMAL |
foreign_keys |
ON |
busy_timeout |
5000 ms |
cache_size |
2000 pages |
mmap_size |
134217728 (128 MiB) |
journal_size_limit |
67108864 (64 MiB) |
temp_store |
unset (opt-in MEMORY) |
Notes
- Applied on every open, not once at startup.
Microsoft.Data.Sqlitepools connections and the per-connection pragmas don't persist, so they are re-applied each time a connection opens (aStateChangehook on the factory's connections; the EF Core package uses aConnectionOpenedinterceptor). Onlyjournal_mode=WALpersists in the database file header. - Fully overridable / opt-outable. Set any option to
nullto leave that pragma at SQLite's own default.
Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/sqlite.md
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Data.Sqlite (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- SQLitePCLRaw.bundle_e_sqlite3 (>= 3.0.3)
- SQLitePCLRaw.core (>= 3.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rask.SQLite:
| Package | Downloads |
|---|---|
|
Rask.SQLite.EntityFrameworkCore
The Entity Framework Core integration for Rask.SQLite: `UseRaskSqlite(...)`, a drop-in replacement for `UseSqlite` that also registers a `ConnectionOpened` interceptor applying the production pragma set (WAL, `synchronous=NORMAL`, `foreign_keys=ON`, a `busy_timeout`, `mmap_size`, `journal_size_limit`) to every connection the context opens. Split out from Rask.SQLite so apps that only need the raw `Microsoft.Data.Sqlite` path (or run on mobile/AOT) don't pull in Entity Framework Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.19.1-alpha.0.1 | 35 | 7/20/2026 |
| 0.19.0 | 54 | 7/20/2026 |
| 0.18.1-alpha.0.38 | 46 | 7/19/2026 |
| 0.18.1-alpha.0.37 | 56 | 7/18/2026 |
| 0.18.1-alpha.0.36 | 44 | 7/18/2026 |
| 0.18.1-alpha.0.35 | 50 | 7/18/2026 |
| 0.18.1-alpha.0.34 | 49 | 7/17/2026 |
| 0.18.1-alpha.0.30 | 41 | 7/17/2026 |
| 0.18.1-alpha.0.27 | 47 | 7/17/2026 |
| 0.18.1-alpha.0.25 | 46 | 7/17/2026 |
| 0.18.1-alpha.0.23 | 45 | 7/17/2026 |
| 0.18.1-alpha.0.22 | 51 | 7/16/2026 |
| 0.18.1-alpha.0.21 | 46 | 7/16/2026 |
| 0.18.1-alpha.0.19 | 53 | 7/16/2026 |
| 0.18.1-alpha.0.15 | 45 | 7/16/2026 |
| 0.18.1-alpha.0.13 | 46 | 7/16/2026 |
| 0.18.1-alpha.0.12 | 44 | 7/16/2026 |
| 0.18.1-alpha.0.10 | 50 | 7/16/2026 |
| 0.18.1-alpha.0.9 | 43 | 7/16/2026 |
| 0.18.1-alpha.0.8 | 48 | 7/16/2026 |