Rig.TUnit.Databases.Sql.Sqlite 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Databases.Sql.Sqlite.
dotnet add package Rig.TUnit.Databases.Sql.Sqlite --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Databases.Sql.Sqlite -Version 0.1.0-beta.2
                    
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="Rig.TUnit.Databases.Sql.Sqlite" Version="0.1.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rig.TUnit.Databases.Sql.Sqlite" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Databases.Sql.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 Rig.TUnit.Databases.Sql.Sqlite --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Databases.Sql.Sqlite, 0.1.0-beta.2"
                    
#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 Rig.TUnit.Databases.Sql.Sqlite@0.1.0-beta.2
                    
#: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=Rig.TUnit.Databases.Sql.Sqlite&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Databases.Sql.Sqlite&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Databases.Sql.Sqlite

In-memory shared-cache SQLite provider — the zero-container fast path for tests that need real SQL semantics.

What this package is

The fast-path SQL provider. SqliteFixture opens a connection to Data Source=file::memory:?cache=shared (or a file on disk when isolation demands it) and holds it open for the fixture's lifetime so the in-memory database persists across DbContext disposals. No container, no Docker, no pull — tests using SQLite finish in tens of milliseconds.

Still participates in Rig.TUnit.Databases.Sql's family contract so the same parity assertions run against SQLite as against the container-backed providers.

When to use it

  • Fast feedback loops where container startup cost dominates.
  • Running the family contract on a machine without Docker.
  • Verifying EF Core LINQ translation is legal across providers.
  • Not for: features SQLite does not support — DbType.RowVersion, schema-aware queries, stored procedures, FOR JSON, full-text search beyond the FTS5 extension. Use a real Postgres/SqlServer for those.

Prerequisites

  • .NET 10 SDK
  • Microsoft.EntityFrameworkCore.Sqlite 10.x (transitive)

Quick start

using Microsoft.EntityFrameworkCore;
using Rig.TUnit.Databases.Sql.Sqlite.Fixtures;

await using var fx = new SqliteFixture();
await fx.InitializeAsync();

var opts = new DbContextOptionsBuilder<TestDb>()
    .UseSqlite(fx.Connection)
    .Options;

Options

Property Type Default Description
Mode SqliteMode SharedCacheMemory SharedCacheMemory / FilePath / PrivateCacheMemory
FilePath string? null Only used when Mode == FilePath
EnableForeignKeys bool true PRAGMA foreign_keys = ON
JournalMode string "WAL" WAL / DELETE / MEMORY

Fixture + helper APIs

  • Rig.TUnit.Databases.Sql.Sqlite.Fixtures.SqliteFixture
  • Rig.TUnit.Databases.Sql.Sqlite.Options.SqliteFixtureOptions
  • Rig.TUnit.Databases.Sql.Sqlite.Builder.SqliteRigBuilder
  • UseSqlite(RigBuilder, …) extension

Per-test isolation

SQLite in-memory is isolated by the fixture owning its open connection — drop the fixture, the DB is gone. For file-mode, the file name includes IsolationKey so parallel tests do not collide.

Parallelism + performance

  • Zero startup (no container).
  • Per-test DbContext: ~5 ms.
  • Safe under full parallelism — each fixture owns its own connection; no cross-test state.

Troubleshooting

  • SQLite Error 19: 'FOREIGN KEY constraint failed' — defaults to ON in the fixture; older codebases assuming OFF will see new failures. Set EnableForeignKeys = false if intentional.
  • Data disappears between tests — the connection was closed; ensure the fixture's connection is the one DbContext uses, not a new one.

See docs/troubleshooting.md#sqlite.

Provider quirks + edge cases

  • SQLite is dynamically typed — decimal round-trip precision is lossy; use TEXT storage (HasConversion<string>()) for money.
  • No schemas; [Table("dbo.Orders")] translates to "dbo.Orders" (literal identifier with dot), not a schema-qualified name.
  • DATETIME is stored as TEXT ISO-8601 by default; timezone round-trip loses tzinfo unless you use DateTimeOffset.

Benchmarks

See SqliteBenchmarks.cs; baseline in benchmarks/baseline-005.json. SQLite is the family's speed-of-light reference.

License

MIT. See LICENSE.

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 Rig.TUnit.Databases.Sql.Sqlite:

Package Downloads
Rig.TUnit.All

Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta.2 45 4/27/2026
0.0.0-alpha.0.14 46 4/26/2026