CSharpDB.Engine 1.2.0

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

CSharpDB.Engine

Lightweight embedded SQL database engine for .NET with single-file storage, WAL durability, concurrent readers, and a typed Collection<T> NoSQL API.

NuGet License: MIT

Overview

CSharpDB.Engine is the main entry point for embedding CSharpDB in your .NET application. It combines the SQL parser, query planner, and B+tree storage engine into a single Database class with two access paths: a full SQL engine and a zero-SQL Collection<T> document API. No external dependencies, no server process, just a single .db file on disk.

Features

  • SQL engine: DDL, DML, JOINs, aggregates, GROUP BY, HAVING, CTEs, views, triggers, indexes
  • NoSQL Collection API: Typed Collection<T> with Put/Get/Delete/Scan/Find
  • Single-file storage: All data in one .db file with 4 KB B+tree pages
  • WAL durability: Write-ahead log with crash recovery
  • Concurrent readers: Snapshot-isolated readers alongside a single writer
  • Statement cache: LRU cache (512 capacity) for parsed and planned queries
  • Fast-path lookups: Direct B+tree access for SELECT ... WHERE pk = value
  • Async-first: All APIs are async/await from top to bottom

Usage

SQL API

using CSharpDB.Engine;

// Open or create a database
await using var db = await Database.OpenAsync("myapp.db");

// Create a table
await db.ExecuteAsync("""
    CREATE TABLE users (
        id INTEGER PRIMARY KEY,
        name TEXT,
        email TEXT
    )
    """);

// Insert data
await db.ExecuteAsync("INSERT INTO users VALUES (1, 'Alice', 'alice@example.com')");

// Query data
var result = await db.ExecuteAsync("SELECT name, email FROM users WHERE id = 1");
while (await result.MoveNextAsync())
{
    Console.WriteLine($"{result.Current[0].AsText} - {result.Current[1].AsText}");
}

// Transactions
await db.BeginTransactionAsync();
await db.ExecuteAsync("INSERT INTO users VALUES (2, 'Bob', 'bob@example.com')");
await db.CommitAsync();

NoSQL Collection API

// Get a typed collection
var users = await db.GetCollectionAsync<User>("users");

// Put a document
await users.PutAsync("alice", new User { Name = "Alice", Age = 30 });

// Get a document
var alice = await users.GetAsync("alice");

// Scan all documents
await foreach (var user in users.ScanAsync())
{
    Console.WriteLine(user.Name);
}

// Find with predicate
var adults = await users.FindAsync(u => u.Age >= 18);

Concurrent Readers

// Create a snapshot-isolated reader session
using var reader = db.CreateReaderSession();
var result = await reader.ExecuteAsync("SELECT * FROM users");
// Reads from a consistent snapshot while the writer continues

Installation

dotnet add package CSharpDB.Engine

Dependencies

  • CSharpDB.Core - shared type system
  • CSharpDB.Sql - SQL parser
  • CSharpDB.Storage - B+tree storage engine
  • CSharpDB.Execution - query planner and operators
Package Description
CSharpDB.Data ADO.NET provider built on this engine
CSharpDB.Service Thread-safe service layer for web apps
CSharpDB.Storage.Diagnostics Storage inspection and integrity checking

License

MIT - see LICENSE for details.

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 CSharpDB.Engine:

Package Downloads
CSharpDB.Data

ADO.NET provider for CSharpDB. Standard DbConnection, DbCommand, and DbDataReader with parameterized queries and transactions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 0 3/5/2026
1.1.0 66 3/4/2026
1.0.0 72 3/1/2026