Rask.SQLite 0.19.0

There is a newer prerelease version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rask.SQLite" Version="0.19.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.SQLite" Version="0.19.0" />
                    
Directory.Packages.props
<PackageReference Include="Rask.SQLite" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rask.SQLite --version 0.19.0
                    
#r "nuget: Rask.SQLite, 0.19.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rask.SQLite@0.19.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rask.SQLite&version=0.19.0
                    
Install as a Cake Addin
#tool nuget:?package=Rask.SQLite&version=0.19.0
                    
Install as a Cake Tool

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.Sqlite pools connections and the per-connection pragmas don't persist, so they are re-applied each time a connection opens (a StateChange hook on the factory's connections; the EF Core package uses a ConnectionOpened interceptor). Only journal_mode=WAL persists in the database file header.
  • Fully overridable / opt-outable. Set any option to null to leave that pragma at SQLite's own default.

Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/sqlite.md

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed