Bit.Bsqlite 11.0.0-pre-10

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

bit Bsqlite

EF Core on SQLite-WASM for Blazor WebAssembly. The same entities and the same migrations on the client as on the server.

This package is everything you need except a persistent backend: the EF Core integration, the ADO.NET surface with live queries, the worker transport, the storage provider contract, a volatile in-memory backend, and the browser assets (SQLite engine builds, worker host, JavaScript API) served under _content/Bit.Bsqlite.

Runtime: .NET 8, 9 and 10, each with its EF Core. License: MIT (bundles wa-sqlite, also MIT).

Install

dotnet add package Bit.Bsqlite

Add a persistent backend — without one you get the in-memory provider, which does not survive a reload:

Package Notes
Bit.Bsqlite.Storage.Opfs Sync engine (smallest download), multi-connection, worker-only
Bit.Bsqlite.Storage.IndexedDb Widest browser reach, runs anywhere, JSPI/Asyncify
Bit.Bsqlite.Storage.CacheStorage Imports a database left behind by Bit.Besql

Register

builder.Services.AddBitBsqliteServices(sqlite => sqlite
    .AddStorageProvider<BsqliteOpfsStorageProvider>()
    .AddStorageProvider<BsqliteIndexedDbStorageProvider>()
    .AddStorageProvider<BsqliteInMemoryStorageProvider>()
    .UseStorage(s => s
        .Prefer(BsqliteOpfsStorageProvider.ProviderName)
        .Fallback(BsqliteIndexedDbStorageProvider.ProviderName)
        .Fallback(BsqliteInMemoryStorageProvider.ProviderName)
        .AllowNonPersistentFallback())
    .AddDatabase("app.db"));

builder.Services.AddBitBsqliteDbContext<AppDbContext>();

Use

@inject IBsqliteDbContextFactory<AppDbContext> Contexts

await using var db = await Contexts.CreateDbContextAsync();   // migrates once per session
var open = await db.Orders.Where(o => o.Open).ToListAsync();

Without dependency injection the same pieces compose by hand:

var session = await factory.OpenAsync("app.db");   // a BsqliteSessionFactory
options.UseBitBsqlite(session.Connection);

Selection is sticky: existing data outranks preference, so a database already written on one backend is reopened there rather than silently starting empty somewhere else. BsqliteStorageMigrationMode.KeepExisting is the default; AutomaticOnOpen copies the image, verifies the SQLite header, then flips the binding.

Live queries

Table-level, and they fire across tabs. A committed write re-runs any live query that reads that table. The worker learns what changed from SQLite's own update hook - cascades and triggers included - and reports it once the transaction commits, so a rolled-back write is never shown and a multi-statement SaveChangesAsync re-runs a query once, not per statement.

await using var live = ctx.Orders.Where(o => o.Open).AsLiveQuery();
live.Changed += (_, rows) => InvokeAsync(StateHasChanged);

Async only

The browser cannot block on storage, so the synchronous ADO.NET surface throws BsqliteSynchronousApiNotSupportedException rather than deadlocking or lying. Use the Async overloads throughout — ToListAsync, SaveChangesAsync, MigrateAsync.

Hosting under a sub-path

Every asset is reached relative to the document, the way Blazor's own are, so an application published under <base href="/app/"> needs no configuration: the host resolves each provider's VFS module - and each extension module - against the document base before the worker imports it.

Caching the browser assets

The host module is imported with a ?v=<assembly version> query and passes it on to the worker and the modules it loads, so an upgrade cannot pair new .NET with JavaScript the browser cached from an older version. The engine files under _content/Bit.Bsqlite/engine carry no query - they change only when the pinned wa-sqlite version does - so if your server sends long max-age headers for static content, exclude _content/Bit.Bsqlite/ or serve it with Cache-Control: no-cache so the browser revalidates.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Bit.Bsqlite:

Package Downloads
Bit.Bsqlite.Storage.CacheStorage

Cache Storage for bit Bsqlite: block-based and journal-committed, and the migration path off Bit.Besql - a database Bit.Besql left in Cache Storage is imported losslessly on first open.

Bit.Bsqlite.Storage.Opfs

OPFS storage for bit Bsqlite, using wa-sqlite's OPFSCoopSyncVFS: persistent, multi-connection, worker-only and without COOP/COEP headers.

Bit.Bsqlite.Storage.IndexedDb

IndexedDB storage for bit Bsqlite, using wa-sqlite's IDBBatchAtomicVFS: persistent, async-capable (JSPI or Asyncify), and available where OPFS is not.

Bit.Bsqlite.Testing

Test support for bit Bsqlite: an in-process IBsqliteTransport backed by Microsoft.Data.Sqlite, so the stack can be unit-tested on desktop .NET without a browser, and the MSTest conformance kit every storage provider must pass - inherit its test classes in your provider's test project and hand them your provider.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.0-pre-10 56 10/18/2026