CodeBrix.Sqlite.ApacheLicenseForever 1.0.213.50

There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeBrix.Sqlite.ApacheLicenseForever --version 1.0.213.50
                    
NuGet\Install-Package CodeBrix.Sqlite.ApacheLicenseForever -Version 1.0.213.50
                    
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="CodeBrix.Sqlite.ApacheLicenseForever" Version="1.0.213.50" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeBrix.Sqlite.ApacheLicenseForever" Version="1.0.213.50" />
                    
Directory.Packages.props
<PackageReference Include="CodeBrix.Sqlite.ApacheLicenseForever" />
                    
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 CodeBrix.Sqlite.ApacheLicenseForever --version 1.0.213.50
                    
#r "nuget: CodeBrix.Sqlite.ApacheLicenseForever, 1.0.213.50"
                    
#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 CodeBrix.Sqlite.ApacheLicenseForever@1.0.213.50
                    
#: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=CodeBrix.Sqlite.ApacheLicenseForever&version=1.0.213.50
                    
Install as a Cake Addin
#tool nuget:?package=CodeBrix.Sqlite.ApacheLicenseForever&version=1.0.213.50
                    
Install as a Cake Tool

CodeBrix.Sqlite

A fully managed, cross-platform SQLite convenience library for .NET, layered on top of Microsoft.Data.Sqlite. At its simplest it is a convenience layer: modern pragma defaults, a Dapper-style mapper, and safe backups. Beyond that it provides selective column and object encryption with a pluggable crypt engine (including a ready-to-use AES-GCM engine), the typed EncryptedTable<T> abstraction with searchable encrypted data and HMAC blind-index equality search, safe quiesce-and-backup orchestration for live databases, and database schema-version helpers. The encryption features are entirely optional — see the plain sample below. CodeBrix.Sqlite depends only on Microsoft.Data.Sqlite and its own version pin of that package's SQLitePCLRaw native bundle, and is provided as a .NET 10 library and associated CodeBrix.Sqlite.ApacheLicenseForever NuGet package.

CodeBrix.Sqlite supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.

CodeBrix.Sqlite supports:

  • Opening SQLite databases with sensible modern defaults — WAL journaling and enforced foreign keys — via the SqliteDatabase entry-point class (sync and async APIs throughout)
  • Encrypting individual column values with any crypt engine implementing IObjectCryptEngine; a production-ready AesGcmCryptEngine (AES-GCM, random nonce per value, PBKDF2 key derivation) is included
  • Storing and retrieving whole CLR objects in encrypted columns: AddEncryptedParameter(), ExecuteDecrypt<T>(), GetDecrypted<T>(), TryDecrypt<T>()
  • The EncryptedTable<T> typed table abstraction: attribute-driven schema ([NotEncrypted], [Searchable], [BlindIndexed], [ColumnName], [NotNull], [ColumnDefaultValue]), a TTL-cached searchable index over encrypted data, and a write-behind item cache
  • HMAC-SHA256 blind-index columns for equality searches over encrypted values — indexed by SQLite itself, with no decrypt scan
  • Safe backup orchestration: quiesce (maintenance mode) → WAL checkpoint → SQLite online backup → resume, plus a one-statement VACUUM INTO snapshot path
  • Database maintenance mode, blocking normal operations while backups or schema changes run
  • user_version schema-version helpers for managing database DDL upgrades over time
  • Dapper-style CRUD extension methods on SqliteConnectionQuery<T>(), QueryFirst/Single(OrDefault)(), Execute(), ExecuteScalar<T>(), ExecuteReader(), QueryMultiple() and their async forms, with anonymous-object parameters and IN-list expansion (API modeled on Dapper 2.1.79) — that are encryption-aware: EncryptedTableItem results decrypt automatically, [EncryptedColumn] POCO properties decrypt on read, and EncryptedValue-wrapped parameters encrypt on bind
  • Column binding that is case-insensitive and underscore-tolerant, so a snake_case schema maps onto PascalCase properties (customer_tierCustomerTier) with no aliases, attributes or configuration — and, unlike stock Dapper, with no MatchNamesWithUnderscores switch to remember
  • A SQLite dependency graph with no known security advisories — see below

Every feature is optional — including encryption

The encryption features are what make this library different, but none of them are mandatory. The cryptEngine constructor argument is optional; omit it and CodeBrix.Sqlite is simply a convenience layer over Microsoft.Data.Sqlite — sensible pragmas, a Dapper-style mapper, and backup orchestration. You can adopt it for the plain case in two minutes and discover the encryption features later, without rewriting anything you wrote first.

A clean SQLite dependency graph

A direct Microsoft.Data.Sqlite reference can resolve SQLitePCLRaw.lib.e_sqlite3 2.1.11, which carries a high-severity advisory (NU1903 / GHSA-2m69-gcr7-jv3q) and obliges the consuming project to add an explicit transitive pin to get a clean build.

CodeBrix.Sqlite pins SQLitePCLRaw.bundle_e_sqlite3 to 3.0.3 on your behalf — deliberately, not incidentally — so referencing this package resolves a graph that dotnet list package --vulnerable --include-transitive reports as clean, with no pin and no explanatory comment needed in your own project file.

Sample Code

The plain case: no encryption at all

using CodeBrix.Sqlite;

using var db = new SqliteDatabase("app.db");
db.SafeOpen(); // creates the file if missing; opens only if not already open
db.ExecuteNonQuery(
    "CREATE TABLE IF NOT EXISTS tickets (id INTEGER PRIMARY KEY, title TEXT, customer_tier TEXT);");

// The Dapper-style methods are extension methods on SqliteConnection,
// so they are reached through the Connection property:
db.Connection.Execute(
    "INSERT INTO tickets (title, customer_tier) VALUES (@Title, @CustomerTier);",
    new { Title = "Investigate timeout", CustomerTier = "gold" });

// 'customer_tier' binds to 'CustomerTier' with no alias and no attribute:
List<Ticket> tickets = db.Connection
    .Query<Ticket>("SELECT id, title, customer_tier FROM tickets ORDER BY id")
    .ToList();

public class Ticket
{
    public long Id { get; set; }
    public string Title { get; set; }
    public string CustomerTier { get; set; }
}

Encrypting column values and backing up a live database

using CodeBrix.Sqlite;
using CodeBrix.Sqlite.Cryptography;
using CodeBrix.Sqlite.Extensions;

using var cryptEngine = new AesGcmCryptEngine("my secret passphrase");
using var database = new SqliteDatabase("/data/mydatabase.sqlite", cryptEngine);
database.Open(); // WAL mode + foreign keys enabled by default

database.ExecuteNonQuery(
    "CREATE TABLE IF NOT EXISTS [Notes] (Id INTEGER PRIMARY KEY AUTOINCREMENT, Secret ENCRYPTED);");

using (var command = database.CreateCommand("INSERT INTO [Notes] (Secret) VALUES (@secret);"))
{
    command.AddEncryptedParameter("@secret", "This text is encrypted at rest.", cryptEngine);
    long rowId = command.ExecuteReturnRowId();
}

using (var command = database.CreateCommand("SELECT [Secret] FROM [Notes] LIMIT 1;"))
{
    string decrypted = command.ExecuteDecrypt<string>(cryptEngine);
}

// Safe backup: quiesce -> WAL checkpoint -> online backup -> resume
database.BackupToFile("/backups/mydatabase-backup.sqlite");
using CodeBrix.Sqlite;
using CodeBrix.Sqlite.Cryptography;
using CodeBrix.Sqlite.EncryptedTables;

public class Contact : EncryptedTableItem
{
    [NotEncrypted] public string Category { get; set; }
    [Searchable] public string FullName { get; set; }
    [Searchable, BlindIndexed] public string Email { get; set; }
    public string PrivateNotes { get; set; } // encrypted, not searchable
}

using var cryptEngine = new AesGcmCryptEngine("my secret passphrase");
using var database = new SqliteDatabase("/data/mydatabase.sqlite", cryptEngine);

using (var contacts = new EncryptedTable<Contact>(database))
{
    contacts.AddItem(new Contact { FullName = "Ada Lovelace", Email = "ada@example.com" });
    contacts.WriteItemChanges();

    // Equality search via the HMAC blind index -- no decrypt scan:
    List<Contact> found = contacts.FindByBlindIndex(nameof(Contact.Email), "ada@example.com");
}

Dapper-style queries that understand encryption

using CodeBrix.Sqlite; // instead of 'using Dapper;'

// The connection of a SqliteDatabase knows its crypt engine ambiently:
var contacts = database.Connection
    .Query<Contact>("SELECT * FROM [Contact] WHERE [Category] = @cat;", new { cat = "Friends" })
    .ToList(); // each row's Encrypted_Object column is decrypted for you

// Encrypted parameter values and encrypted POCO columns:
database.Connection.Execute(
    "INSERT INTO [Vault] (Label, Secret) VALUES (@label, @secret);",
    new { label = "api-key", secret = new EncryptedValue("hunter2") });

public class VaultRow
{
    public long Id { get; set; }
    public string Label { get; set; }
    [EncryptedColumn] public string Secret { get; set; } // decrypted on read
}
var row = database.Connection.QuerySingle<VaultRow>("SELECT * FROM [Vault] WHERE [Label] = 'api-key';");

License

The project is licensed under the Apache 2.0 License. see: https://en.wikipedia.org/wiki/Apache_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 (2)

Showing the top 2 NuGet packages that depend on CodeBrix.Sqlite.ApacheLicenseForever:

Package Downloads
CodeBrix.Platform.AppSettings.ApacheLicenseForever

A persistent application-settings system for CodeBrix.Platform apps on every head: Windows (Win32 and Skia-on-WPF), Linux (X11, Wayland, FrameBuffer), and macOS. Unlike the other add-ins this one has no UI - it is the storage layer an application's own settings screen (or an application with no settings screen at all) writes through. Every configurable value lives as JSON in a single portable settings.sqlite database under the user's per-user configuration folder, reached through the static AppSettingsService facade: Get, Set, HasValue, per-key and global change notification, and typed AppSettingProperty handles with old-key migration. The store manages its own file lifecycle - a timestamped automatic backup with retention pruning on every start, quarantine of a corrupt database and restore from the newest good backup, silent first-run creation, plus export to a self-contained file and validated import staged for adoption on the next start. Initialize with nothing but the application name and the location is chosen for you.

CodeBrix.Platform.TclTk.Extras.BsdLicenseForever

Interpreter-side Tcl command extensions for CodeBrix.Platform.TclTk: a tclsqlite-compatible "sqlite3" database command backed by CodeBrix.Sqlite, and a pdf4tcl-compatible PDF drawing command set backed by CodeBrix.PdfDocuments. Lets existing Tcl programs that expect the sqlite3 and pdf4tcl packages run unmodified on the managed interpreter, with no native Tcl dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.250.22 72 9/7/2026
1.0.238.153 111 8/26/2026
1.0.213.50 141 8/1/2026
1.0.187.759 126 7/6/2026